Don't crash on Autobahn testing

This commit is contained in:
Alex Hultman
2018-11-21 19:09:42 +01:00
parent 1a3395bb5a
commit 8bf87c9147
3 changed files with 5 additions and 3 deletions
+1 -1
View File
@@ -31,7 +31,7 @@ int main(int argc, char **argv) {
std::cout << "WebSocket conntected to URL: " << req->getUrl() << std::endl;
}, [](auto *ws, std::string_view message, uWS::OpCode opCode) {
ws->send(message, opCode);
}).listen(3000, [](auto *token) {
}).listen(9001, [](auto *token) {
if (token) {
std::cout << "Listening on port " << 3000 << std::endl;
}
+3 -1
View File
@@ -20,13 +20,15 @@ public:
// if corkAllocate(size) then corkFree(unused)
// 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);
Super::write(buf, writeLength);
free(buf);
}
// absolutely not public!