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
| 859 | because we have a threshold on the buffer size to avoid too much |
| 860 | buffering. See send_callback(). */ |
| 861 | static 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 */ |
| 878 | static void eventcb(struct bufferevent *bev, short events, void *ptr) { |
nothing calls this directly
no test coverage detected