Don't crash on Autobahn testing
This commit is contained in:
+1
-1
@@ -31,7 +31,7 @@ int main(int argc, char **argv) {
|
|||||||
std::cout << "WebSocket conntected to URL: " << req->getUrl() << std::endl;
|
std::cout << "WebSocket conntected to URL: " << req->getUrl() << std::endl;
|
||||||
}, [](auto *ws, std::string_view message, uWS::OpCode opCode) {
|
}, [](auto *ws, std::string_view message, uWS::OpCode opCode) {
|
||||||
ws->send(message, opCode);
|
ws->send(message, opCode);
|
||||||
}).listen(3000, [](auto *token) {
|
}).listen(9001, [](auto *token) {
|
||||||
if (token) {
|
if (token) {
|
||||||
std::cout << "Listening on port " << 3000 << std::endl;
|
std::cout << "Listening on port " << 3000 << std::endl;
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-1
@@ -20,13 +20,15 @@ public:
|
|||||||
// if corkAllocate(size) then corkFree(unused)
|
// if corkAllocate(size) then corkFree(unused)
|
||||||
|
|
||||||
// format the response
|
// format the response
|
||||||
char buf[100];
|
char *buf = (char *) malloc(message.length() + 100);
|
||||||
int writeLength = WebSocketProtocol<isServer, WebSocket<SSL, isServer>>::formatMessage(buf, message.data(), message.length(), opCode, message.length(), false);
|
int writeLength = WebSocketProtocol<isServer, WebSocket<SSL, isServer>>::formatMessage(buf, message.data(), message.length(), opCode, message.length(), false);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Super::write(buf, writeLength);
|
Super::write(buf, writeLength);
|
||||||
|
|
||||||
|
free(buf);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// absolutely not public!
|
// absolutely not public!
|
||||||
|
|||||||
+1
-1
Submodule uSockets updated: 70e1cc081f...4a20739ca5
Reference in New Issue
Block a user