MCPcopy Create free account
hub / github.com/OpenSIPS/opensips / session_recv

Function session_recv

modules/http2d/server.c:300–318  ·  view source on GitHub ↗

Read the data in the bufferevent and feed them into nghttp2 library function. Invocation of nghttp2_session_mem_recv2() may make additional pending frames, so call session_send() at the end of the function. */

Source from the content-addressed store, hash-verified

298 additional pending frames, so call session_send() at the end of the
299 function. */
300static int session_recv(http2_session_data *session_data) {
301 nghttp2_ssize readlen;
302 struct evbuffer *input = bufferevent_get_input(session_data->bev);
303 size_t datalen = evbuffer_get_length(input);
304 unsigned char *data = evbuffer_pullup(input, -1);
305
306 readlen = nghttp2_session_mem_recv2(session_data->session, data, datalen);
307 if (readlen < 0) {
308 LM_WARN("Fatal error: %s", nghttp2_strerror((int)readlen));
309 return -1;
310 }
311 if (evbuffer_drain(input, (size_t)readlen) != 0) {
312 LM_WARN("Fatal error: evbuffer_drain failed");
313 return -1;
314 }
315 if (session_send(session_data) != 0)
316 return -1;
317 return 0;
318}
319
320static nghttp2_ssize send_callback(nghttp2_session *session,
321 const uint8_t *data, size_t length,

Callers 1

readcbFunction · 0.85

Calls 1

session_sendFunction · 0.85

Tested by

no test coverage detected