nitlanguage
/
nit.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
847bad9
)
lib/socket: set `last_error` on connection failed
author
Alexis Laferrière
<alexis.laf@xymus.net>
Tue, 2 Jun 2015 15:03:21 +0000
(11:03 -0400)
committer
Alexis Laferrière
<alexis.laf@xymus.net>
Tue, 2 Jun 2015 15:41:57 +0000
(11:41 -0400)
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
lib/socket/socket.nit
patch
|
blob
|
history
diff --git
a/lib/socket/socket.nit
b/lib/socket/socket.nit
index
7791159
..
a40cc5d
100644
(file)
--- a/
lib/socket/socket.nit
+++ b/
lib/socket/socket.nit
@@
-85,12
+85,15
@@
class TCPStream
end
addrin = new NativeSocketAddrIn.with_hostent(hostname, port)
-
address = addrin.address
init(addrin.port, hostname.h_name)
closed = not internal_connect
end_reached = closed
+ if closed then
+ # Connection failed
+ last_error = new IOError(errno.strerror)
+ end
end
# Creates a client socket, this is meant to be used by accept only