Remove uWS namespace specifier
This commit is contained in:
@@ -127,7 +127,7 @@ public:
|
||||
}
|
||||
|
||||
TemplatedApp(SocketContextOptions options = {}) {
|
||||
httpContext = uWS::HttpContext<SSL>::create(uWS::Loop::get(), options);
|
||||
httpContext = HttpContext<SSL>::create(Loop::get(), options);
|
||||
}
|
||||
|
||||
bool constructorFailed() {
|
||||
@@ -151,12 +151,12 @@ public:
|
||||
/* Maximum socket lifetime in seconds before forced closure (defaults to disabled) */
|
||||
unsigned short maxLifetime = 0;
|
||||
MoveOnlyFunction<void(HttpResponse<SSL> *, HttpRequest *, struct us_socket_context_t *)> upgrade = nullptr;
|
||||
MoveOnlyFunction<void(uWS::WebSocket<SSL, true> *)> open = nullptr;
|
||||
MoveOnlyFunction<void(uWS::WebSocket<SSL, true> *, std::string_view, uWS::OpCode)> message = nullptr;
|
||||
MoveOnlyFunction<void(uWS::WebSocket<SSL, true> *)> drain = nullptr;
|
||||
MoveOnlyFunction<void(uWS::WebSocket<SSL, true> *)> ping = nullptr;
|
||||
MoveOnlyFunction<void(uWS::WebSocket<SSL, true> *)> pong = nullptr;
|
||||
MoveOnlyFunction<void(uWS::WebSocket<SSL, true> *, int, std::string_view)> close = nullptr;
|
||||
MoveOnlyFunction<void(WebSocket<SSL, true> *)> open = nullptr;
|
||||
MoveOnlyFunction<void(WebSocket<SSL, true> *, std::string_view, OpCode)> message = nullptr;
|
||||
MoveOnlyFunction<void(WebSocket<SSL, true> *)> drain = nullptr;
|
||||
MoveOnlyFunction<void(WebSocket<SSL, true> *)> ping = nullptr;
|
||||
MoveOnlyFunction<void(WebSocket<SSL, true> *)> pong = nullptr;
|
||||
MoveOnlyFunction<void(WebSocket<SSL, true> *, int, std::string_view)> close = nullptr;
|
||||
};
|
||||
|
||||
template <typename UserData>
|
||||
@@ -187,7 +187,7 @@ public:
|
||||
|
||||
/* Quick fix to disable any compression if set */
|
||||
#ifdef UWS_NO_ZLIB
|
||||
behavior.compression = uWS::DISABLED;
|
||||
behavior.compression = DISABLED;
|
||||
#endif
|
||||
|
||||
/* If we are the first one to use compression, initialize it */
|
||||
|
||||
+1
-1
@@ -133,7 +133,7 @@ private:
|
||||
#endif
|
||||
|
||||
/* The return value is entirely up to us to interpret. The HttpParser only care for whether the returned value is DIFFERENT or not from passed user */
|
||||
void *returnedSocket = httpResponseData->consumePostPadded(data, (unsigned int) length, s, proxyParser, [httpContextData](void *s, uWS::HttpRequest *httpRequest) -> void * {
|
||||
void *returnedSocket = httpResponseData->consumePostPadded(data, (unsigned int) length, s, proxyParser, [httpContextData](void *s, HttpRequest *httpRequest) -> void * {
|
||||
/* For every request we reset the timeout and hang until user makes action */
|
||||
/* Warning: if we are in shutdown state, resetting the timer is a security issue! */
|
||||
us_socket_timeout(SSL, (us_socket_t *) s, 0);
|
||||
|
||||
+1
-1
@@ -242,7 +242,7 @@ public:
|
||||
int wantedCompressionWindow = (webSocketContextData->compression & 0xFF00) >> 8;
|
||||
|
||||
auto [negCompression, negCompressionWindow, negInflationWindow, negResponse] =
|
||||
uWS::negotiateCompression(true, wantedCompressionWindow, wantedInflationWindow,
|
||||
negotiateCompression(true, wantedCompressionWindow, wantedInflationWindow,
|
||||
secWebSocketExtensions);
|
||||
|
||||
if (negCompression) {
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@
|
||||
#ifndef UWS_LOOP_H
|
||||
#define UWS_LOOP_H
|
||||
|
||||
/* The loop is lazily created per-thread and run with uWS::run() */
|
||||
/* The loop is lazily created per-thread and run with run() */
|
||||
|
||||
#include "LoopData.h"
|
||||
#include <libusockets.h>
|
||||
|
||||
+1
-1
@@ -64,7 +64,7 @@ public:
|
||||
|
||||
/* Send or buffer a WebSocket frame, compressed or not. Returns BACKPRESSURE on increased user space backpressure,
|
||||
* DROPPED on dropped message (due to backpressure) or SUCCCESS if you are free to send even more now. */
|
||||
SendStatus send(std::string_view message, uWS::OpCode opCode = uWS::OpCode::BINARY, bool compress = false) {
|
||||
SendStatus send(std::string_view message, OpCode opCode = OpCode::BINARY, bool compress = false) {
|
||||
WebSocketContextData<SSL> *webSocketContextData = (WebSocketContextData<SSL> *) us_socket_context_ext(SSL,
|
||||
(us_socket_context_t *) us_socket_context(SSL, (us_socket_t *) this)
|
||||
);
|
||||
|
||||
@@ -41,7 +41,7 @@ private:
|
||||
}
|
||||
|
||||
/* If we have negotiated compression, set this frame compressed */
|
||||
static bool setCompressed(uWS::WebSocketState<isServer> */*wState*/, void *s) {
|
||||
static bool setCompressed(WebSocketState<isServer> */*wState*/, void *s) {
|
||||
WebSocketData *webSocketData = (WebSocketData *) us_socket_ext(SSL, (us_socket_t *) s);
|
||||
|
||||
if (webSocketData->compressionStatus == WebSocketData::CompressionStatus::ENABLED) {
|
||||
@@ -52,12 +52,12 @@ private:
|
||||
}
|
||||
}
|
||||
|
||||
static void forceClose(uWS::WebSocketState<isServer> */*wState*/, void *s, std::string_view reason = {}) {
|
||||
static void forceClose(WebSocketState<isServer> */*wState*/, void *s, std::string_view reason = {}) {
|
||||
us_socket_close(SSL, (us_socket_t *) s, (int) reason.length(), (void *) reason.data());
|
||||
}
|
||||
|
||||
/* Returns true on breakage */
|
||||
static bool handleFragment(char *data, size_t length, unsigned int remainingBytes, int opCode, bool fin, uWS::WebSocketState<isServer> *webSocketState, void *s) {
|
||||
static bool handleFragment(char *data, size_t length, unsigned int remainingBytes, int opCode, bool fin, WebSocketState<isServer> *webSocketState, void *s) {
|
||||
/* WebSocketData and WebSocketContextData */
|
||||
WebSocketContextData<SSL> *webSocketContextData = (WebSocketContextData<SSL> *) us_socket_context_ext(SSL, us_socket_context(SSL, (us_socket_t *) s));
|
||||
WebSocketData *webSocketData = (WebSocketData *) us_socket_ext(SSL, (us_socket_t *) s);
|
||||
@@ -90,7 +90,7 @@ private:
|
||||
|
||||
/* Emit message event & break if we are closed or shut down when returning */
|
||||
if (webSocketContextData->messageHandler) {
|
||||
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), (OpCode) opCode);
|
||||
if (us_socket_is_closed(SSL, (us_socket_t *) s) || webSocketData->isShuttingDown) {
|
||||
return true;
|
||||
}
|
||||
@@ -148,7 +148,7 @@ private:
|
||||
|
||||
/* Emit message and check for shutdown or close */
|
||||
if (webSocketContextData->messageHandler) {
|
||||
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), (OpCode) opCode);
|
||||
if (us_socket_is_closed(SSL, (us_socket_t *) s) || webSocketData->isShuttingDown) {
|
||||
return true;
|
||||
}
|
||||
@@ -224,7 +224,7 @@ private:
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool refusePayloadLength(uint64_t length, uWS::WebSocketState<isServer> */*wState*/, void *s) {
|
||||
static bool refusePayloadLength(uint64_t length, WebSocketState<isServer> */*wState*/, void *s) {
|
||||
auto *webSocketContextData = (WebSocketContextData<SSL> *) us_socket_context_ext(SSL, us_socket_context(SSL, (us_socket_t *) s));
|
||||
|
||||
/* Return true for refuse, false for accept */
|
||||
@@ -283,7 +283,7 @@ private:
|
||||
asyncSocket->cork();
|
||||
|
||||
/* This parser has virtually no overhead */
|
||||
uWS::WebSocketProtocol<isServer, WebSocketContext<SSL, isServer>>::consume(data, (unsigned int) length, (WebSocketState<isServer> *) webSocketData, s);
|
||||
WebSocketProtocol<isServer, WebSocketContext<SSL, isServer>>::consume(data, (unsigned int) length, (WebSocketState<isServer> *) webSocketData, s);
|
||||
|
||||
/* Uncorking a closed socekt is fine, in fact it is needed */
|
||||
asyncSocket->uncork();
|
||||
|
||||
@@ -47,8 +47,8 @@ private:
|
||||
|
||||
public:
|
||||
/* The callbacks for this context */
|
||||
MoveOnlyFunction<void(uWS::WebSocket<SSL, true> *)> openHandler = nullptr;
|
||||
MoveOnlyFunction<void(WebSocket<SSL, true> *, std::string_view, uWS::OpCode)> messageHandler = nullptr;
|
||||
MoveOnlyFunction<void(WebSocket<SSL, true> *)> openHandler = nullptr;
|
||||
MoveOnlyFunction<void(WebSocket<SSL, true> *, std::string_view, OpCode)> messageHandler = nullptr;
|
||||
MoveOnlyFunction<void(WebSocket<SSL, true> *)> drainHandler = nullptr;
|
||||
MoveOnlyFunction<void(WebSocket<SSL, true> *, int, std::string_view)> closeHandler = nullptr;
|
||||
/* Todo: these should take message also; breaking change for v0.18 */
|
||||
|
||||
Reference in New Issue
Block a user