diff options
Diffstat (limited to 'src/library.js')
-rw-r--r-- | src/library.js | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/src/library.js b/src/library.js index f8ea67ba..b63ac955 100644 --- a/src/library.js +++ b/src/library.js @@ -5082,6 +5082,10 @@ LibraryManager.library = { _ZSt18uncaught_exceptionv: function() { // std::uncaught_exception() return !!__ZSt18uncaught_exceptionv.uncaught_exception; }, + __cxa_uncaught_exception__deps: ['_Zst18uncaught_exceptionv'], + __cxa_uncaught_exception: function() { + return !!__ZSt18uncaught_exceptionv.uncaught_exception; + }, __cxa_call_unexpected: function(exception) { Module.printErr('Unexpected exception thrown, this is not properly supported - aborting'); @@ -7293,11 +7297,17 @@ LibraryManager.library = { // exceptfds not supported // timeout is always 0 - fully async assert(!exceptfds); + + var errorCondition = 0; function canRead(info) { // make sure hasData exists. // we do create it when the socket is connected, // but other implementations may create it lazily + if ((info.socket.readyState == WebSocket.CLOSING || info.socket.readyState == WebSocket.CLOSED) && info.inQueue.length == 0) { + errorCondition = -1; + return false; + } return info.hasData && info.hasData(); } @@ -7305,6 +7315,10 @@ LibraryManager.library = { // make sure socket exists. // we do create it when the socket is connected, // but other implementations may create it lazily + if ((info.socket.readyState == WebSocket.CLOSING || info.socket.readyState == WebSocket.CLOSED)) { + errorCondition = -1; + return false; + } return info.socket && (info.socket.readyState == info.socket.OPEN); } @@ -7336,8 +7350,13 @@ LibraryManager.library = { return bitsSet; } - return checkfds(nfds, readfds, canRead) - + checkfds(nfds, writefds, canWrite); + var totalHandles = checkfds(nfds, readfds, canRead) + checkfds(nfds, writefds, canWrite); + if (errorCondition) { + ___setErrNo(ERRNO_CODES.EBADF); + return -1; + } else { + return totalHandles; + } }, // pty.h |