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

Function writecb

modules/http2d/server.c:861–875  ·  view source on GitHub ↗

writecb for bufferevent. To greaceful shutdown after sending or receiving GOAWAY, we check the some conditions on the nghttp2 library and output buffer of bufferevent. If it indicates we have no business to this session, tear down the connection. If the connection is not going to shutdown, we call session_send() to process pending data in the output buffer. This is necessary beca

Source from the content-addressed store, hash-verified

859 because we have a threshold on the buffer size to avoid too much
860 buffering. See send_callback(). */
861static void writecb(struct bufferevent *bev, void *ptr) {
862 http2_session_data *session_data = (http2_session_data *)ptr;
863 if (evbuffer_get_length(bufferevent_get_output(bev)) > 0)
864 return;
865
866 if (nghttp2_session_want_read(session_data->session) == 0 &&
867 nghttp2_session_want_write(session_data->session) == 0) {
868 delete_http2_session_data(session_data);
869 return;
870 }
871 if (session_send(session_data) != 0) {
872 delete_http2_session_data(session_data);
873 return;
874 }
875}
876
877/* eventcb for bufferevent */
878static void eventcb(struct bufferevent *bev, short events, void *ptr) {

Callers

nothing calls this directly

Calls 2

session_sendFunction · 0.85

Tested by

no test coverage detected