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

Function eventcb

modules/http2d/server.c:878–917  ·  view source on GitHub ↗

eventcb for bufferevent */

Source from the content-addressed store, hash-verified

876
877/* eventcb for bufferevent */
878static void eventcb(struct bufferevent *bev, short events, void *ptr) {
879 http2_session_data *session_data = (http2_session_data *)ptr;
880 if (events & BEV_EVENT_CONNECTED) {
881 const unsigned char *alpn = NULL;
882 unsigned int alpnlen = 0;
883 SSL *ssl;
884 (void)bev;
885
886 LM_INFO("%s connected\n", session_data->client_addr);
887
888 ssl = bufferevent_openssl_get_ssl(session_data->bev);
889
890 SSL_get0_alpn_selected(ssl, &alpn, &alpnlen);
891
892 if (alpn == NULL || alpnlen != 2 || memcmp("h2", alpn, 2) != 0) {
893 LM_ERR("%s h2 is not negotiated\n", session_data->client_addr);
894 delete_http2_session_data(session_data);
895 return;
896 }
897
898 initialize_nghttp2_session(session_data);
899
900 if (send_server_connection_header(session_data) != 0 ||
901 session_send(session_data) != 0) {
902 delete_http2_session_data(session_data);
903 return;
904 }
905
906 return;
907 }
908
909 if (events & BEV_EVENT_EOF)
910 LM_INFO("%s EOF\n", session_data->client_addr);
911 else if (events & BEV_EVENT_ERROR)
912 LM_INFO("%s network error\n", session_data->client_addr);
913 else if (events & BEV_EVENT_TIMEOUT)
914 LM_INFO("%s timeout\n", session_data->client_addr);
915
916 delete_http2_session_data(session_data);
917}
918
919/* callback for evconnlistener */
920static void acceptcb(struct evconnlistener *listener, int fd,

Callers

nothing calls this directly

Calls 4

session_sendFunction · 0.85

Tested by

no test coverage detected