Skip to content

Commit

Permalink
[wasm64] Fix WebSocket API under wasm64 (#21514)
Browse files Browse the repository at this point in the history
Fixes: #21503
  • Loading branch information
sbc100 committed Mar 12, 2024
1 parent dd53c6c commit 0b55292
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/library_websocket.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ var LibraryWebSocket = {
dbg(`websocket event "open": socketId=${socketId},userData=${userData},callbackFunc=${callbackFunc})`);
#endif
HEAPU32[WS.socketEvent>>2] = socketId;
{{{ makeDynCall('iiii', 'callbackFunc') }}}(0/*TODO*/, WS.socketEvent, userData);
{{{ makeDynCall('iipp', 'callbackFunc') }}}(0/*TODO*/, WS.socketEvent, userData);
}
return {{{ cDefs.EMSCRIPTEN_RESULT_SUCCESS }}};
},
Expand All @@ -181,7 +181,7 @@ var LibraryWebSocket = {
dbg(`websocket event "error": socketId=${socketId},userData=${userData},callbackFunc=${callbackFunc})`);
#endif
HEAPU32[WS.socketEvent>>2] = socketId;
{{{ makeDynCall('iiii', 'callbackFunc') }}}(0/*TODO*/, WS.socketEvent, userData);
{{{ makeDynCall('iipp', 'callbackFunc') }}}(0/*TODO*/, WS.socketEvent, userData);
}
return {{{ cDefs.EMSCRIPTEN_RESULT_SUCCESS }}};
},
Expand Down Expand Up @@ -210,7 +210,7 @@ var LibraryWebSocket = {
HEAPU32[(WS.socketEvent+4)>>2] = e.wasClean;
HEAPU32[(WS.socketEvent+8)>>2] = e.code;
stringToUTF8(e.reason, WS.socketEvent+10, 512);
{{{ makeDynCall('iiii', 'callbackFunc') }}}(0/*TODO*/, WS.socketEvent, userData);
{{{ makeDynCall('iipp', 'callbackFunc') }}}(0/*TODO*/, WS.socketEvent, userData);
}
return {{{ cDefs.EMSCRIPTEN_RESULT_SUCCESS }}};
},
Expand Down Expand Up @@ -262,7 +262,7 @@ var LibraryWebSocket = {
}
HEAPU32[(WS.socketEvent+4)>>2] = buf;
HEAPU32[(WS.socketEvent+8)>>2] = len;
{{{ makeDynCall('iiii', 'callbackFunc') }}}(0/*TODO*/, WS.socketEvent, userData);
{{{ makeDynCall('iipp', 'callbackFunc') }}}(0/*TODO*/, WS.socketEvent, userData);
_free(buf);
}
return {{{ cDefs.EMSCRIPTEN_RESULT_SUCCESS }}};
Expand Down
8 changes: 8 additions & 0 deletions test/test_sockets.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,3 +349,11 @@ def test_posix_proxy_sockets(self):
with PythonTcpEchoServerProcess('7777'):
# Build and run the TCP echo client program with Emscripten
self.btest_exit('websocket/tcp_echo_client.c', args=['-lwebsocket', '-sPROXY_POSIX_SOCKETS', '-pthread', '-sPROXY_TO_PTHREAD'])


class sockets64(sockets):
def setUp(self):
super().setUp()
self.set_setting('MEMORY64')
self.emcc_args.append('-Wno-experimental')
self.require_wasm64()

0 comments on commit 0b55292

Please sign in to comment.