diff --git a/tunnels/client/http2/helpers.h b/tunnels/client/http2/helpers.h index 1051ff4d..d2a0ab03 100644 --- a/tunnels/client/http2/helpers.h +++ b/tunnels/client/http2/helpers.h @@ -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) @@ -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; diff --git a/tunnels/client/http2/http2_client.c b/tunnels/client/http2/http2_client.c index f2162b95..2d00ce98 100644 --- a/tunnels/client/http2/http2_client.c +++ b/tunnels/client/http2/http2_client.c @@ -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; diff --git a/tunnels/server/http2/helpers.h b/tunnels/server/http2/helpers.h index 1413eb8b..98030cf9 100644 --- a/tunnels/server/http2/helpers.h +++ b/tunnels/server/http2/helpers.h @@ -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) @@ -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; diff --git a/tunnels/server/http2/http2_server.c b/tunnels/server/http2/http2_server.c index afa0bd30..92032af2 100644 --- a/tunnels/server/http2/http2_server.c +++ b/tunnels/server/http2/http2_server.c @@ -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; @@ -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) {