Use us_socket_is_closed, fix non-SSL/Windows build
This commit is contained in:
+2
-5
@@ -29,9 +29,6 @@
|
|||||||
#include <string_view>
|
#include <string_view>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
|
||||||
/* This is a hack for now on, update uSockets */
|
|
||||||
extern "C" int us_internal_socket_is_closed(struct us_socket *s);
|
|
||||||
|
|
||||||
namespace uWS {
|
namespace uWS {
|
||||||
template<bool> struct HttpResponse;
|
template<bool> struct HttpResponse;
|
||||||
|
|
||||||
@@ -153,7 +150,7 @@ private:
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
/* Was the socket closed? */
|
/* Was the socket closed? */
|
||||||
if (us_internal_socket_is_closed((struct us_socket *) s)) {
|
if (us_socket_is_closed((struct us_socket *) s)) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -173,7 +170,7 @@ private:
|
|||||||
httpResponseData->inStream(data);
|
httpResponseData->inStream(data);
|
||||||
|
|
||||||
/* Was the socket closed? */
|
/* Was the socket closed? */
|
||||||
if (us_internal_socket_is_closed((struct us_socket *) user)) {
|
if (us_socket_is_closed((struct us_socket *) user)) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -22,6 +22,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
namespace uWS {
|
namespace uWS {
|
||||||
|
|
||||||
|
|||||||
@@ -22,6 +22,26 @@
|
|||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
#include <libusockets.h>
|
#include <libusockets.h>
|
||||||
|
|
||||||
|
/* For now we just define all these as nonsense if using a non-SSL version of uSockets */
|
||||||
|
#ifdef LIBUS_NO_SSL
|
||||||
|
#define us_ssl_socket_context_options int
|
||||||
|
#define us_ssl_socket_context_ext us_socket_context_ext
|
||||||
|
#define us_ssl_socket_context_on_open us_socket_context_on_open
|
||||||
|
#define us_ssl_socket_timeout us_socket_timeout
|
||||||
|
#define us_ssl_socket_ext us_socket_ext
|
||||||
|
#define us_ssl_socket_context_on_close us_socket_context_on_close
|
||||||
|
#define us_ssl_socket_context_on_data us_socket_context_on_data
|
||||||
|
#define us_ssl_socket_context_on_writable us_socket_context_on_writable
|
||||||
|
#define us_ssl_socket_context_on_end us_socket_context_on_end
|
||||||
|
#define us_ssl_socket_context_on_timeout us_socket_context_on_timeout
|
||||||
|
#define us_ssl_socket_is_shut_down us_socket_is_shut_down
|
||||||
|
#define us_ssl_socket_close us_socket_close
|
||||||
|
#define us_ssl_socket_write us_socket_write
|
||||||
|
#define us_ssl_socket_context_loop us_socket_context_loop
|
||||||
|
#define us_ssl_socket_get_context us_socket_get_context
|
||||||
|
#define us_ssl_socket_context_listen us_socket_context_listen
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace uWS {
|
namespace uWS {
|
||||||
|
|
||||||
template <bool SSL>
|
template <bool SSL>
|
||||||
|
|||||||
@@ -23,9 +23,6 @@
|
|||||||
#include "WebSocketData.h"
|
#include "WebSocketData.h"
|
||||||
#include "AsyncSocket.h"
|
#include "AsyncSocket.h"
|
||||||
|
|
||||||
/* This is a hack for now on, update uSockets */
|
|
||||||
extern "C" int us_internal_socket_is_closed(struct us_socket *s);
|
|
||||||
|
|
||||||
namespace uWS {
|
namespace uWS {
|
||||||
|
|
||||||
template <bool SSL, bool isServer>
|
template <bool SSL, bool isServer>
|
||||||
@@ -122,7 +119,7 @@ private:
|
|||||||
|
|
||||||
/* Emit message event & break if we are closed or shut down when returning */
|
/* Emit message event & break if we are closed or shut down when returning */
|
||||||
webSocketContextData->messageHandler((WebSocket<SSL, isServer> *) s, std::string_view(data, length), (uWS::OpCode) opCode);
|
webSocketContextData->messageHandler((WebSocket<SSL, isServer> *) s, std::string_view(data, length), (uWS::OpCode) opCode);
|
||||||
if (us_internal_socket_is_closed((us_socket *) s) || webSocketData->isShuttingDown) {
|
if (us_socket_is_closed((us_socket *) s) || webSocketData->isShuttingDown) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -183,7 +180,7 @@ private:
|
|||||||
|
|
||||||
/* Emit message and check for shutdown or close */
|
/* Emit message and check for shutdown or close */
|
||||||
webSocketContextData->messageHandler((WebSocket<SSL, isServer> *) s, std::string_view(data, length), (uWS::OpCode) opCode);
|
webSocketContextData->messageHandler((WebSocket<SSL, isServer> *) s, std::string_view(data, length), (uWS::OpCode) opCode);
|
||||||
if (us_internal_socket_is_closed((us_socket *) s) || webSocketData->isShuttingDown) {
|
if (us_socket_is_closed((us_socket *) s) || webSocketData->isShuttingDown) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
Submodule uSockets updated: 3d1f6fbb50...b1f18bcab3
Reference in New Issue
Block a user