[NaCl SDK] nacl_io: fix for send/recv from closed connections.

When the remote side closes the connection the socket
fd should be marked as readable and writable (so poll()
and select() return).  Calls to send should then return
EPIPE and recv() should be able to read remaining
buffered data after which it should return 0.

Also, any data written to the socket before close should
be sent, even after the socket is closes (true for both
UDP and TCP).  To do this we have the outbound work items
hold a reference to the socket node for as long as they
exist.

Added several new tests for this behavior.

Still not supported: SO_LINGER and blocking close/shutdown
which is achievable with SO_LINGER.

BUG=306592
R=binji@chromium.org, noelallen@chromium.org

Review URL: https://codereview.chromium.org/27036006

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@229699 0039d316-1c4b-4281-b951-d872f2087c98
SVN changes up to revision 229699