Added spdylay_on_{ctrl,data}_sent_callback functions
This commit is contained in:
parent
1ce97c7d5e
commit
a657208ffd
|
@ -206,6 +206,21 @@ typedef void (*spdylay_on_data_recv_callback)
|
|||
(spdylay_session *session, uint8_t flags, int32_t stream_id, int32_t length,
|
||||
void *user_data);
|
||||
|
||||
/*
|
||||
* Callback function invoked after frame |frame| of type |type| is
|
||||
* sent.
|
||||
*/
|
||||
typedef void (*spdylay_on_ctrl_send_callback)
|
||||
(spdylay_session *session, spdylay_frame_type type, spdylay_frame *frame,
|
||||
void *user_data);
|
||||
|
||||
/*
|
||||
* Callback function invoked after DATA frame is sent.
|
||||
*/
|
||||
typedef void (*spdylay_on_data_send_callback)
|
||||
(spdylay_session *session, uint8_t flags, int32_t stream_id, int32_t length,
|
||||
void *user_data);
|
||||
|
||||
typedef struct {
|
||||
spdylay_send_callback send_callback;
|
||||
spdylay_recv_callback recv_callback;
|
||||
|
@ -214,6 +229,8 @@ typedef struct {
|
|||
spdylay_on_ping_recv_callback on_ping_recv_callback;
|
||||
spdylay_on_data_chunk_recv_callback on_data_chunk_recv_callback;
|
||||
spdylay_on_data_recv_callback on_data_recv_callback;
|
||||
spdylay_on_ctrl_send_callback on_ctrl_send_callback;
|
||||
spdylay_on_data_send_callback on_data_send_callback;
|
||||
} spdylay_session_callbacks;
|
||||
|
||||
int spdylay_session_client_new(spdylay_session **session_ptr,
|
||||
|
|
|
@ -399,6 +399,18 @@ static int spdylay_session_after_frame_sent(spdylay_session *session)
|
|||
/* TODO handle FIN flag. */
|
||||
spdylay_frame *frame = session->aob.item->frame;
|
||||
spdylay_frame_type type = session->aob.item->frame_type;
|
||||
if(type == SPDYLAY_DATA) {
|
||||
if(session->callbacks.on_data_send_callback) {
|
||||
session->callbacks.on_data_send_callback
|
||||
(session, frame->data.flags, frame->data.stream_id,
|
||||
session->aob.framebuflen, session->user_data);
|
||||
}
|
||||
} else {
|
||||
if(session->callbacks.on_ctrl_send_callback) {
|
||||
session->callbacks.on_ctrl_send_callback
|
||||
(session, type, frame, session->user_data);
|
||||
}
|
||||
}
|
||||
switch(type) {
|
||||
case SPDYLAY_SYN_STREAM: {
|
||||
spdylay_stream *stream =
|
||||
|
|
Loading…
Reference in New Issue