From: Alexis Laferrière Date: Sun, 5 Jul 2015 17:52:13 +0000 (-0400) Subject: lib/socket: move `blocking=` to `Socket` X-Git-Tag: v0.7.7~19^2~3 X-Git-Url: http://nitlanguage.org?hp=6cfd779c164b283dcc0de95e128a1e7c50752c15 lib/socket: move `blocking=` to `Socket` Signed-off-by: Alexis Laferrière --- diff --git a/lib/socket/socket.nit b/lib/socket/socket.nit index 7e9018f..d20bc0c 100644 --- a/lib/socket/socket.nit +++ b/lib/socket/socket.nit @@ -29,6 +29,14 @@ abstract class Socket # Is this socket closed? var closed = false + # Set whether calls to `accept` are blocking + fun blocking=(value: Bool) + do + # We use the opposite from the native version as the native API + # is closer to the C API. In the Nity API, we use a positive version + # of the name. + native.non_blocking = not value + end end # A general TCP socket, either a `TCPStream` or a `TCPServer` @@ -293,15 +301,6 @@ class TCPServer return new TCPStream.server_side(native) end - # Set whether calls to `accept` are blocking - fun blocking=(value: Bool) - do - # We use the opposite from the native version as the native API - # is closer to the C API. In the Nity API, we use a positive version - # of the name. - native.non_blocking = not value - end - # Close this socket fun close do