summaryrefslogtreecommitdiff
path: root/src/tcp_listener.cpp
diff options
context:
space:
mode:
authormalosek <malosek@fastmq.com>2009-10-05 10:22:31 +0200
committermalosek <malosek@fastmq.com>2009-10-05 10:22:31 +0200
commitd57ee0984ac3f8712063a7f83d7200be25ca5513 (patch)
treea956443e70c48ebd21242c11cc015db61c53c682 /src/tcp_listener.cpp
parentff65e26ce7567ea6a907e566f8530f4988231d68 (diff)
parent4efe2366d7394e8969fc9aa64c50be6842d8455f (diff)
Merge branch 'master' of git@github.com:sustrik/zeromq2
Diffstat (limited to 'src/tcp_listener.cpp')
-rw-r--r--src/tcp_listener.cpp17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/tcp_listener.cpp b/src/tcp_listener.cpp
index 9431ccf..383aebe 100644
--- a/src/tcp_listener.cpp
+++ b/src/tcp_listener.cpp
@@ -48,8 +48,10 @@ int zmq::tcp_listener_t::set_address (const char *addr_)
// Create a listening socket.
s = socket (AF_INET, SOCK_STREAM, IPPROTO_TCP);
- // TODO: Convert error code to errno.
- wsa_assert (s != INVALID_SOCKET);
+ if (s == INVALID_SOCKET) {
+ wsa_error_to_errno ();
+ return -1;
+ }
// Allow reusing of the address.
int flag = 1;
@@ -65,12 +67,17 @@ int zmq::tcp_listener_t::set_address (const char *addr_)
// Bind the socket to the network interface and port.
rc = bind (s, (struct sockaddr*) &addr, sizeof (addr));
// TODO: Convert error code to errno.
- wsa_assert (rc != SOCKET_ERROR);
+ if (rc == SOCKET_ERROR) {
+ wsa_error_to_errno ();
+ return -1;
+ }
// Listen for incomming connections.
rc = listen (s, 1);
- // TODO: Convert error code to errno.
- wsa_assert (rc != SOCKET_ERROR);
+ if (rc == SOCKET_ERROR) {
+ wsa_error_to_errno ();
+ return -1;
+ }
return 0;
}