diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-04-01 12:55:33 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-04-01 12:55:33 -0700 |
commit | 8408257cd66435af849f493c10c7f0e8d1d5fa3b (patch) | |
tree | 8b05963e8608b22f71620f512679d7cd5b1de548 /src/library.js | |
parent | a8e4801c7d38033fff760ea26a4579aa324e303e (diff) | |
parent | 36600f34ef0ec2cf75165be3753567e256f514db (diff) |
Merge branch 'incoming'
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 |