kripken/emscripten — pull request #1477 by inolen (2013-08-07 21:28:49+00:00)
Title: misc socket-related library fixes and updated websocket tests

There are a few minor socket-related library fixes (I cherry-picked these from the larger changes to get the tests working):
- select shouldn't return an error when the socket is valid, but disconnected
- recv should return 0 once the socket has disconnected
- send should set ENOTCONN once closed, and EAGAIN while connecting
- connect should return -1 (and set EINPROGRESS) when using O_NONBLOCK

The majority of this changelist is related to updating the tests to use O_NONBLOCK and updating the tests better conform to emscripten's coding standards (admittedly this probably wasn't the smartest thing to do).

I removed websockets_bi_listener.js as I didn't particularly want to update / fix it right now, and the functionality it's testing will become a standard part of the test suite very soon. I'd like to replace each of the websockify server functions with an actual server .c file that we can run natively and proxy to with websockify, or compile down and run in node with the new listen functionality that's coming.

It's probably best to review each commit individually otherwise the commit renaming the websockets_* tests to sockets_* may really throw off the diff.