Merge: lib/socket: fix, update style and intro features
authorJean Privat <jean@pryen.org>
Wed, 24 Dec 2014 01:22:16 +0000 (20:22 -0500)
committerJean Privat <jean@pryen.org>
Wed, 24 Dec 2014 01:22:16 +0000 (20:22 -0500)
commitedc8f7f282da990dca97ce9f13e60bac0e8e4e45
tree85d10b23e690c81fb3977385a41e7ee58a2752ea
parent9ce36063c3b99efd75f7f3f95596b08a360fa710
parent07ab5a297b80c12ac94a24d7facabf860f3c278e
Merge: lib/socket: fix, update style and intro features

This is a pretty big update to the `socket` module. It appeared to be broken. Did someone test it since the last modifications to streams and read_line?

* Update and cleanup the style in the first 3 or 4 commits.
* Fix (some of) what was broken.
* Revamp the API with a distinction between listening sockets and stream sockets (making it closer to Ruby and C#). This is the most important commit "lib/socket: distinguish `TCPServer` from `TCPStream`".
* Intro additionnal features used by Mineit: non-blocking `TCPServer` sockets and `TCPStream::flush`.

Still to do:
* Add `Error` support to the API.
* Rename `socket_c` to `native_socket`.
* Fix `SocketObserver` and underlying C implementation.

Pull-Request: #1063
Reviewed-by: Jean Privat <jean@pryen.org>
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>