[nanomsg] Re: nn_bind issues

  • From: Martin Sustrik <sustrik@xxxxxxxxxx>
  • To: nanomsg@xxxxxxxxxxxxx
  • Date: Sun, 17 Nov 2013 19:50:41 +0100

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 17/11/13 19:33, Dirkjan Ochtman wrote:

> (Anyway, it sounds like nn_bind() should definitely return -1 and
> set errno to EADDRINUSE instead of asserting, but I think Martin
> will jump in on some point. It might make sense to file an issue
> with a reduced test case, if possible?)

It's not that easy. Not being able to bind should in some cases be
handled by re-trying later. E.g. when you wi-fi is off, you can't bind
to wlan0. You would still want the socket to bind once you get to the
area with wi-fi.

That being the case, consider the following scenario: Two applications
try to bind to wlan0:5555. The wi-fi is currently off, thus neither
succeeds, but they don't report the error to the user, rather they
wait for wlan0 to become available.

Once wi-fi is on, one application connects, other one fails
*asynchronously* with EADDRINUSE. What now?

Martin

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBAgAGBQJSiRABAAoJENTpVjxCNN9YgmQH+we1HU7RzAM9HQ0vUXV70S4R
jOKHfNqXPiKmw8lEkfHW0Y2lP8nNTPbAqgLjkhz2Yi8e2ish/v1wJfld0vXbNwuU
KS/LE2RvxuItrO72bZCYK8kqMCccVq1rbVRfOn4R0hkdn2gCUBMio4IaZhNBPZfk
pkw3l4d3JupMiMPQIbseUdUfjvVgtAsZ2fbAayUXE7WOJfqWwLUFfrGpjkko/Ok0
6YAYmQo0FVTn/giFBDo6BZUmYmM2xuc677DVORf/xuZvorrXqKZOnRa8uYFTOGN7
3waXqqO6CrxZWRY3DiTFrrglK5OpEGox9iyLEWsAPs2xGuiR1s8B2tuIeFp5HMY=
=dTB1
-----END PGP SIGNATURE-----

Other related posts: