Handle socket closing, shutdown, error & (upgrade) in HTTP handlers

This commit is contained in:
Alex Hultman
2018-10-17 22:23:25 +02:00
parent 8105c65fa6
commit 8cfda9f4b0
4 changed files with 127 additions and 51 deletions
+10
View File
@@ -9,6 +9,11 @@
namespace uWS {
// we need a variant of this where any failed write triggers a timeout!
// AsyncSocket needs to derive from a uSockets base we can select like so:
// HttpResponse -> AsyncSocket<T> -> TimeoutSocket or Socket (make StaticDispath Socket)
template <bool SSL>
struct AsyncSocket : StaticDispatch<SSL> {
template <bool> friend struct HttpContext;
@@ -40,6 +45,11 @@ protected:
return static_dispatch(us_ssl_socket_close, us_socket_close)((SOCKET_TYPE *) this);
}
bool isFullyOpen() {
// todo:: not shutdown or closed
return true;
}
/* Cork this socket. Only one socket may ever be corked per-loop at any given time */
void cork() {
//std::cout << "Cork called" << std::endl;