Skip to content

Commit

Permalink
fix typo and change increase max allowed frame size
Browse files Browse the repository at this point in the history
  • Loading branch information
radkesvat committed Apr 24, 2024
1 parent f56056b commit e2c6715
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 28 deletions.
11 changes: 6 additions & 5 deletions tunnels/client/http2/helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ static nghttp2_nv makeNV2(const char *name, const char *value, int namelen, int
static void printFrameHd(const nghttp2_frame_hd *hd)
{
(void) hd;
// LOGD("[frame] length=%d type=%x flags=%x stream_id=%d\n", (int) hd->length, (int) hd->type, (int) hd->flags,
// hd->stream_id);
LOGD("[frame] length=%d type=%x flags=%x stream_id=%d\n", (int) hd->length, (int) hd->type, (int) hd->flags,
hd->stream_id);
}

static void addStraem(http2_client_con_state_t *con, http2_client_child_con_state_t *stream)
Expand Down Expand Up @@ -139,10 +139,11 @@ static http2_client_con_state_t *createHttp2Connection(tunnel_t *self, int tid,
con->line->chains_state[self->chain_index] = con;

hevent_set_userdata(con->ping_timer, con);

nghttp2_session_client_new2(&con->session, state->cbs, con, state->ngoptions);

nghttp2_settings_entry settings[] = {{NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS, MAX_CONCURRENT_STREAMS}};
nghttp2_settings_entry settings[] = {
{NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS, MAX_CONCURRENT_STREAMS},
{NGHTTP2_SETTINGS_MAX_FRAME_SIZE, (1U << 18)},
};
nghttp2_submit_settings(con->session, NGHTTP2_FLAG_NONE, settings, ARRAY_SIZE(settings));

con->state = kH2SendMagic;
Expand Down
2 changes: 1 addition & 1 deletion tunnels/client/http2/http2_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ static bool trySendRequest(tunnel_t *self, http2_client_con_state_t *con, size_t

shiftl(buf, GRPC_MESSAGE_HDLEN);

grpcMessageHdUnpack(&msghd, rawBufMut(buf));
grpcMessageHdPack(&msghd, rawBufMut(buf));
}
http2_frame_hd framehd;

Expand Down
9 changes: 6 additions & 3 deletions tunnels/server/http2/helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ static nghttp2_nv makeNv2(const char *name, const char *value, int namelen, int
static void printFrameHd(const nghttp2_frame_hd *hd)
{
(void) hd;
// LOGD("[frame] length=%d type=%x flags=%x stream_id=%d\n", (int) hd->length, (int) hd->type, (int) hd->flags,
// hd->stream_id);
LOGD("[frame] length=%d type=%x flags=%x stream_id=%d\n", (int) hd->length, (int) hd->type, (int) hd->flags,
hd->stream_id);
}

static void addStream(http2_server_con_state_t *con, http2_server_child_con_state_t *stream)
Expand Down Expand Up @@ -93,7 +93,10 @@ static http2_server_con_state_t *createHttp2Connection(tunnel_t *self, line_t *l
con->line = line;
con->io = io;

nghttp2_settings_entry settings[] = {{NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS, MAX_CONCURRENT_STREAMS}};
nghttp2_settings_entry settings[] = {
{NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS, MAX_CONCURRENT_STREAMS},
{NGHTTP2_SETTINGS_MAX_FRAME_SIZE, (1U << 18)},
};
nghttp2_submit_settings(con->session, NGHTTP2_FLAG_NONE, settings, ARRAY_SIZE(settings));
con->state = kH2SendSettings;
return con;
Expand Down
21 changes: 2 additions & 19 deletions tunnels/server/http2/http2_server.c
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ static bool trySendResponse(tunnel_t *self, http2_server_con_state_t *con, size_

shiftl(buf, GRPC_MESSAGE_HDLEN);

grpcMessageHdUnpack(&msghd, rawBufMut(buf));
grpcMessageHdPack(&msghd, rawBufMut(buf));
}

http2_frame_hd framehd;
Expand Down Expand Up @@ -420,24 +420,7 @@ static inline void downStream(tunnel_t *self, context_t *c)
}
}

static void http2ServerUpStream(tunnel_t *self, context_t *c)
{
upStream(self, c);
}
static void http2ServerPacketUpStream(tunnel_t *self, context_t *c)
{
// LOGF("Http2Server: Http2 protocol dose not run on udp");
upStream(self, c);
}
static void http2ServerDownStream(tunnel_t *self, context_t *c)
{
downStream(self, c);
}
static void http2ServerPacketDownStream(tunnel_t *self, context_t *c)
{
// LOGF("Http2Server: Http2 protocol dose not run on udp");
downStream(self, c);
}


tunnel_t *newHttp2Server(node_instance_context_t *instance_info)
{
Expand Down

0 comments on commit e2c6715

Please sign in to comment.