diff --git a/benchmarks/broadcast_test.c b/benchmarks/broadcast_test.c index 0912590..464eeb8 100644 --- a/benchmarks/broadcast_test.c +++ b/benchmarks/broadcast_test.c @@ -91,7 +91,7 @@ struct us_socket_t *on_http_socket_writable(struct us_socket_t *s) { return s; } -struct us_socket_t *on_http_socket_close(struct us_socket_t *s) { +struct us_socket_t *on_http_socket_close(struct us_socket_t *s, int code, void *reason) { printf("Client was disconnected, exiting!\n"); exit(-1); @@ -100,7 +100,7 @@ struct us_socket_t *on_http_socket_close(struct us_socket_t *s) { } struct us_socket_t *on_http_socket_end(struct us_socket_t *s) { - return us_socket_close(SSL, s); + return us_socket_close(SSL, s, 0, NULL); } struct us_socket_t *on_http_socket_data(struct us_socket_t *s, char *data, int length) { diff --git a/benchmarks/load_test.c b/benchmarks/load_test.c index 98bc4d2..460e871 100644 --- a/benchmarks/load_test.c +++ b/benchmarks/load_test.c @@ -75,7 +75,7 @@ struct us_socket_t *on_http_socket_writable(struct us_socket_t *s) { return s; } -struct us_socket_t *on_http_socket_close(struct us_socket_t *s) { +struct us_socket_t *on_http_socket_close(struct us_socket_t *s, int code, void *reason) { printf("Closed!\n"); @@ -83,7 +83,7 @@ struct us_socket_t *on_http_socket_close(struct us_socket_t *s) { } struct us_socket_t *on_http_socket_end(struct us_socket_t *s) { - return us_socket_close(SSL, s); + return us_socket_close(SSL, s, 0, NULL); } struct us_socket_t *on_http_socket_data(struct us_socket_t *s, char *data, int length) { diff --git a/benchmarks/scale_test.c b/benchmarks/scale_test.c index 63f0196..6f76d70 100644 --- a/benchmarks/scale_test.c +++ b/benchmarks/scale_test.c @@ -93,7 +93,7 @@ struct us_socket_t *on_http_socket_writable(struct us_socket_t *s) { return s; } -struct us_socket_t *on_http_socket_close(struct us_socket_t *s) { +struct us_socket_t *on_http_socket_close(struct us_socket_t *s, int code, void *reason) { closed_connections++; if (closed_connections % 1000 == 0) { @@ -104,7 +104,7 @@ struct us_socket_t *on_http_socket_close(struct us_socket_t *s) { } struct us_socket_t *on_http_socket_end(struct us_socket_t *s) { - return us_socket_close(SSL, s); + return us_socket_close(SSL, s, 0, NULL); } // should never get a response! diff --git a/src/AsyncSocket.h b/src/AsyncSocket.h index 998f253..5052deb 100644 --- a/src/AsyncSocket.h +++ b/src/AsyncSocket.h @@ -62,7 +62,7 @@ protected: /* Immediately close socket */ us_socket_t *close() { - return us_socket_close(SSL, (us_socket_t *) this); + return us_socket_close(SSL, (us_socket_t *) this, 0, nullptr); } /* Cork this socket. Only one socket may ever be corked per-loop at any given time */ diff --git a/src/HttpContext.h b/src/HttpContext.h index 80bda91..07c6921 100644 --- a/src/HttpContext.h +++ b/src/HttpContext.h @@ -79,7 +79,7 @@ private: }); /* Handle socket disconnections */ - us_socket_context_on_close(SSL, getSocketContext(), [](us_socket_t *s) { + us_socket_context_on_close(SSL, getSocketContext(), [](us_socket_t *s, int code, void *reason) { /* Get socket ext */ HttpResponseData *httpResponseData = (HttpResponseData *) us_socket_ext(SSL, s); @@ -144,7 +144,7 @@ private: /* Are we not ready for another request yet? Terminate the connection. */ if (httpResponseData->state & HttpResponseData::HTTP_RESPONSE_PENDING) { - us_socket_close(SSL, (us_socket_t *) s); + us_socket_close(SSL, (us_socket_t *) s, 0, nullptr); return nullptr; } @@ -155,7 +155,7 @@ private: httpContextData->router.getUserData() = {(HttpResponse *) s, httpRequest}; if (!httpContextData->router.route(httpRequest->getMethod(), httpRequest->getUrl())) { /* We have to force close this socket as we have no handler for it */ - us_socket_close(SSL, (us_socket_t *) s); + us_socket_close(SSL, (us_socket_t *) s, 0, nullptr); return nullptr; } @@ -225,7 +225,7 @@ private: return user; }, [](void *user) { /* Close any socket on HTTP errors */ - us_socket_close(SSL, (us_socket_t *) user); + us_socket_close(SSL, (us_socket_t *) user, 0, nullptr); return nullptr; }); diff --git a/src/WebSocketContext.h b/src/WebSocketContext.h index a578af1..4087b2b 100644 --- a/src/WebSocketContext.h +++ b/src/WebSocketContext.h @@ -53,7 +53,7 @@ private: } static void forceClose(uWS::WebSocketState *wState, void *s) { - us_socket_close(SSL, (us_socket_t *) s); + us_socket_close(SSL, (us_socket_t *) s, 0, nullptr); } /* Returns true on breakage */ @@ -237,7 +237,7 @@ private: * any backpressure from HTTP state kept. */ /* Handle socket disconnections */ - us_socket_context_on_close(SSL, getSocketContext(), [](auto *s) { + us_socket_context_on_close(SSL, getSocketContext(), [](auto *s, int code, void *reason) { /* For whatever reason, if we already have emitted close event, do not emit it again */ WebSocketData *webSocketData = (WebSocketData *) (us_socket_ext(SSL, s)); if (!webSocketData->isShuttingDown) { @@ -351,7 +351,7 @@ private: us_socket_context_on_end(SSL, getSocketContext(), [](auto *s) { /* If we get a fin, we just close I guess */ - us_socket_close(SSL, (us_socket_t *) s); + us_socket_close(SSL, (us_socket_t *) s, 0, nullptr); return s; }); @@ -360,7 +360,7 @@ private: us_socket_context_on_timeout(SSL, getSocketContext(), [](auto *s) { /* Timeout is very simple; we just close it */ - us_socket_close(SSL, (us_socket_t *) s); + us_socket_close(SSL, (us_socket_t *) s, 0, nullptr); return s; }); diff --git a/uSockets b/uSockets index 5308a47..577c822 160000 --- a/uSockets +++ b/uSockets @@ -1 +1 @@ -Subproject commit 5308a478e23f0c102c6ca1aafa738c0b7b8e87fb +Subproject commit 577c822ac2e27d297eb6ea8712c84db5bbfe3b44