BugID:17646749:[h2 stream] modify frame callback
@@ -245,6 +245,7 @@ static void on_stream_chunk_recv(int32_t stream_id, const uint8_t *data, uint32_
static void on_stream_close(int32_t stream_id, uint32_t error_code)
{
http2_stream_node_t *node;
+
if (g_stream_handle == NULL) {
return;
}
@@ -253,38 +254,45 @@ static void on_stream_close(int32_t stream_id, uint32_t error_code)
return;
}
if (g_stream_handle->cbs && g_stream_handle->cbs->on_stream_close_cb) {
- g_stream_handle->cbs->on_stream_close_cb(node->stream_id, node->channel_id, error_code,node->user_data);
+ g_stream_handle->cbs->on_stream_close_cb(stream_id, node->channel_id, error_code, node->user_data);
}
}
static void on_stream_frame_send(int32_t stream_id, int type, uint8_t flags)
{
http2_stream_node_t *node;
+ char *channel_id = NULL;
+ char *user_data = NULL;
+
if (g_stream_handle == NULL) {
return;
}
http2_stream_node_search(g_stream_handle, stream_id, &node);
- if (node == NULL) {
- return;
+ if (node != NULL) {
+ channel_id = node->channel_id;
+ user_data = node->user_data;
}
if (g_stream_handle->cbs && g_stream_handle->cbs->on_stream_frame_send_cb) {
- g_stream_handle->cbs->on_stream_frame_send_cb(node->stream_id,node->channel_id, type, flags,node->user_data);
+ g_stream_handle->cbs->on_stream_frame_send_cb(stream_id, channel_id, type, flags, user_data);
}
}
static void on_stream_frame_recv(int32_t stream_id, int type, uint8_t flags)
{
http2_stream_node_t *node;
+ char *channel_id = NULL;
+ char *user_data = NULL;
if (g_stream_handle == NULL) {
return;
}
http2_stream_node_search(g_stream_handle, stream_id, &node);
- if (node == NULL) {
- return;
+ if (node != NULL) {
+ channel_id = node->channel_id;
+ user_data = node->user_data;
}
if (g_stream_handle->cbs && g_stream_handle->cbs->on_stream_frame_recv_cb) {
- g_stream_handle->cbs->on_stream_frame_recv_cb(node->stream_id,node->channel_id, type, flags,node->user_data);
+ g_stream_handle->cbs->on_stream_frame_recv_cb(stream_id, channel_id, type, flags, user_data);
}
}
@@ -362,7 +370,8 @@ static void *http2_io(void *user_data)
return NULL;
}
-static int http2_stream_node_insert(stream_handle_t *handle, unsigned int id, void *user_data, http2_stream_node_t **p_node)
+static int http2_stream_node_insert(stream_handle_t *handle, unsigned int id, void *user_data,
+ http2_stream_node_t **p_node)
{
http2_stream_node_t *node = NULL;
void *semaphore = NULL;
