Skip to content

Commit

Permalink
Finish new http2, bugs fixed, renamed enums
Browse files Browse the repository at this point in the history
  • Loading branch information
radkesvat committed Jul 12, 2024
1 parent c31a9d8 commit 6efb59e
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 12 deletions.
12 changes: 8 additions & 4 deletions tunnels/client/http2/http2_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ enum
static int onStreamClosedCallback(nghttp2_session *session, int32_t stream_id, uint32_t error_code, void *userdata)
{
(void) error_code;
(void) userdata;

http2_client_con_state_t *con = (http2_client_con_state_t *) userdata;
http2_client_child_con_state_t *stream = nghttp2_session_get_stream_user_data(session, stream_id);
Expand All @@ -40,7 +41,7 @@ static void flushWriteQueue(http2_client_con_state_t *con)
http2_client_child_con_state_t *stream = CSTATE(stream_context);

lockLine(stream->line);
action_queue_t_push(&con->actions, (http2_action_t) {.action_id = kActionStreamData,
action_queue_t_push(&con->actions, (http2_action_t) {.action_id = kActionConData,
.stream_line = stream->line,
.buf = stream_context->payload});
}
Expand Down Expand Up @@ -110,7 +111,7 @@ static int onDataChunkRecvCallback(nghttp2_session *session, uint8_t flags, int3
lockLine(stream->line);

action_queue_t_push(&con->actions,
(http2_action_t) {.action_id = kActionStreamData, .stream_line = stream->line, .buf = buf});
(http2_action_t) {.action_id = kActionStreamDataReceived, .stream_line = stream->line, .buf = buf});

return 0;
}
Expand Down Expand Up @@ -322,7 +323,7 @@ static void doHttp2Action(const http2_action_t action, http2_client_con_state_t

break;

case kActionStreamData: {
case kActionStreamDataReceived: {
if (con->content_type == kApplicationGrpc)
{
bufferStreamPush(stream->grpc_buffer_stream, action.buf);
Expand Down Expand Up @@ -392,7 +393,10 @@ static void doHttp2Action(const http2_action_t action, http2_client_con_state_t
dest->downStream(dest, fc);
}
break;

case kActionConData: {
sendStreamData(con,stream,action.buf);
}
break;
case kActionInvalid:
LOGF("incorrect http2 action id");
exit(1);
Expand Down
5 changes: 2 additions & 3 deletions tunnels/client/http2/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@ enum http2_actions
kActionInvalid,
kActionStreamEst,
kActionStreamFinish,
kActionStreamData,
kActionConData,
kActionConFinish
kActionStreamDataReceived,
kActionConData
};

typedef struct http2_action_s
Expand Down
4 changes: 2 additions & 2 deletions tunnels/server/http2/http2_server.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ static int onDataChunkRecvCallback(nghttp2_session *session, uint8_t flags, int3

lockLine(stream->line);
action_queue_t_push(&con->actions,
(http2_action_t) {.action_id = kActionStreamData, .stream_line = stream->line, .buf = buf});
(http2_action_t) {.action_id = kActionStreamDataReceived, .stream_line = stream->line, .buf = buf});
return 0;
}

Expand Down Expand Up @@ -316,7 +316,7 @@ static void doHttp2Action(const http2_action_t action, http2_server_con_state_t

break;

case kActionStreamData: {
case kActionStreamDataReceived: {
if (con->content_type == kApplicationGrpc)
{
bufferStreamPush(stream->grpc_buffer_stream, action.buf);
Expand Down
6 changes: 3 additions & 3 deletions tunnels/server/http2/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ enum http2_actions
kActionInvalid,
kActionStreamInit,
kActionStreamFinish,
kActionStreamData,
kActionConData,
kActionConFinish
kActionStreamDataReceived,
kActionConData
// kActionConFinish
};

typedef struct http2_action_s
Expand Down

0 comments on commit 6efb59e

Please sign in to comment.