diff options
-rw-r--r-- | src/library.js | 7 | ||||
-rwxr-xr-x | tests/runner.py | 2 | ||||
-rw-r--r-- | tests/sockets/webrtc_host.c | 2 | ||||
-rw-r--r-- | tests/test_sockets.py | 12 |
4 files changed, 12 insertions, 11 deletions
diff --git a/src/library.js b/src/library.js index d4218bb2..872c33a7 100644 --- a/src/library.js +++ b/src/library.js @@ -7237,7 +7237,7 @@ LibraryManager.library = { socket__deps: ['$FS', '$Sockets'], socket: function(family, type, protocol) { var INCOMING_QUEUE_LENGTH = 64; - var stream = FS.createStream({ + var info = FS.createStream({ addr: null, port: null, inQueue: new CircularBuffer(INCOMING_QUEUE_LENGTH), @@ -7246,7 +7246,7 @@ LibraryManager.library = { socket: true, stream_ops: {} }); - assert(stream.fd < 64); // select() assumes socket fd values are in 0..63 + assert(info.fd < 64); // select() assumes socket fd values are in 0..63 var stream = type == {{{ cDefine('SOCK_STREAM') }}}; if (protocol) { assert(stream == (protocol == {{{ cDefine('IPPROTO_TCP') }}})); // if stream, must be tcp @@ -7359,8 +7359,7 @@ LibraryManager.library = { } }; }; - - return stream.fd; + return info.fd; }, mkport__deps: ['$Sockets'], diff --git a/tests/runner.py b/tests/runner.py index af671c11..2c6af351 100755 --- a/tests/runner.py +++ b/tests/runner.py @@ -480,7 +480,7 @@ def server_func(dir, q): if 'report_' in s.path: q.put(s.path) else: - filename = s.path[1:] + filename = s.path.split('?')[0][1:] if os.path.exists(filename): s.send_response(200) s.send_header("Content-type", "text/html") diff --git a/tests/sockets/webrtc_host.c b/tests/sockets/webrtc_host.c index 410184ad..770e59e0 100644 --- a/tests/sockets/webrtc_host.c +++ b/tests/sockets/webrtc_host.c @@ -39,7 +39,7 @@ void iter(void* arg) { #if EMSCRIPTEN int result = 1; - // REPORT_RESULT(); + REPORT_RESULT(); exit(EXIT_SUCCESS); emscripten_cancel_main_loop(); #endif diff --git a/tests/test_sockets.py b/tests/test_sockets.py index 70679b15..4f6ee2a9 100644 --- a/tests/test_sockets.py +++ b/tests/test_sockets.py @@ -223,10 +223,10 @@ class sockets(BrowserCore): session: undefined, onpeer: function(peer, route) { window.open('http://localhost:8888/peer.html?' + route); - //iframe = document.createElement("IFRAME"); - //iframe.setAttribute("src", "http://localhost:8888/peer.html?" + route); - //iframe.style.display = "none"; - //document.body.appendChild(iframe); + // iframe = document.createElement("IFRAME"); + // iframe.setAttribute("src", "http://localhost:8888/peer.html?" + route); + // iframe.style.display = "none"; + // document.body.appendChild(iframe); peer.listen(); }, onconnect: function(peer) { @@ -236,7 +236,7 @@ class sockets(BrowserCore): onerror: function(error) { console.error(error); } - } + }, }; ''') @@ -251,6 +251,8 @@ class sockets(BrowserCore): onconnect: function(peer) { }, ondisconnect: function(peer) { + // Calling window.close() from this handler hangs my browser, so run it in the next turn + setTimeout(window.close, 0); }, onerror: function(error) { console.error(error); |