Browse files

Merge pull request #35 from mkoppanen/no-assert-on-bind

Thanks, affected by this yesterday - merging.
  • Loading branch information...
2 parents df8d649 + 556e0e1 commit 02315627831148e48ed4d13d3f86b89be7beec45 @methodmissing committed Apr 25, 2012
Showing with 5 additions and 6 deletions.
  1. +5 −6 src/zsocket.c
View
11 src/zsocket.c
@@ -69,8 +69,7 @@ zsocket_destroy (zctx_t *ctx, void *socket)
// --------------------------------------------------------------------------
// Bind a socket to a formatted endpoint. If the port is specified as
// '*', binds to any free port from ZSOCKET_DYNFROM to ZSOCKET_DYNTO
-// and returns the actual port number used. Otherwise asserts that the
-// bind succeeded with the specified port number. Always returns the
+// and returns the actual port number used. Always returns the
// port number if successful.
int
@@ -99,12 +98,12 @@ zsocket_bind (void *socket, const char *format, ...)
}
else {
rc = zmq_bind (socket, endpoint);
- if (rc)
- fprintf (stderr, "E: zsocket_bind to %s failed\n", endpoint);
- assert (rc == 0);
// Return actual port used for binding
- rc = atoi (strrchr (endpoint, ':') + 1);
+ if (rc == 0)
+ rc = atoi (strrchr (endpoint, ':') + 1);
+ else
+ rc = -1;
}
return rc;
}

0 comments on commit 0231562

Please sign in to comment.