uProxy/socks-rtc — pull request #37 by keroserene (2014-02-16 02:40:34+00:00)
Title: disconnections - end-to-end works both ways

Use `msg.text` as payload to signal disconnections across the datachannel.

- `SOCKS-DISCONNECT` occurs when the SocksToRtc's TCP request socket disconnects, ending the SOCKS session. This signal crosses the data channel to close the RtcToNet's client socket.
- `NET-DISCONNECT` occurs when the RtcToNet socket connection to destination closes first. This signal crosses the data channel to close the SocksToRtc side SOCKS session / TCP connection.
- Fixed *local* vs. *remote* disconnection semantics. The `onceDisconnected`-like promises only fulfill for remote disconnection events. This prevents cyclical/redundant calls to disconnection handlers & checks, since the closing code paths can occur in either direction.

Eventually, when the freedom datachannels properly send closes across to the remote peer, this may be removed.

Tested: End-to-end