[nanomsg] Re: Help with an IPC problem!

  • From: Martin Sustrik <sustrik@xxxxxxxxxx>
  • To: nanomsg@xxxxxxxxxxxxx
  • Date: Thu, 06 Nov 2014 20:14:19 +0100

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

Not a bad idea! I'll try to implement that.

Thanks!
Martin

On 06/11/14 19:52, Paul Colomiets wrote:
> Hi Martin,
> 
> On Thu, Nov 6, 2014 at 8:42 PM, Martin Sustrik <sustrik@xxxxxxxxxx>
> wrote:
>> What would help is testing (in nn_bind) whether the IPC file is 
>> actually used by anybody and if not so, deleting it.
> 
> The common pattern is in process doing bind to something like this
> (pseudocode):
> 
> if not bind(s, xx) { y = socket(...) if connect(y, xx) { raise
> "Address already in use" } close(y); } unlink(xx) if not bind(s,
> xx) { raise "Race condition: Address already in use" }
> 
> I.e. check if you can connect to socket, then it's used. Note, 
> hovewer, I'm not sure what happens if old process hangs not doing 
> "accept()". Probably result EINPROGRESS for "connect()" should be 
> considered successful.
> 

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)

iQEcBAEBAgAGBQJUW8iLAAoJENTpVjxCNN9YRl4IAJCzM3Sr0sS5SLI+0eHdIYc2
mnXd9uDR4d0TH3jZHdRM6Kak+KKffx0IFOCU4HK2IQ7A7vjrnqZTWAE5lYGjJIP1
/55tJ2Eps5sJXGorFZqt9/9ueHzMaV90kJstkAEFZxaqyuCseO/d5rY+CDvdgucx
BdBPIAFeGHyZgYW8sGsCxCXTvBxDRbGWEW9dOt81jE+AjlfAzXIk+ymmc2nJP627
ZDVWh8v+jp0aD3RDjrH2dV5QIGItSsKkQcf+InUQiEf4UWXxTBlSuy/MfYPM+7zk
Sqn8Absh0KylszZjikIn2PdULGklKsWJ8AciBQtQzLNKa9ZmVi3gkUaHsXYpCM8=
=LsOw
-----END PGP SIGNATURE-----

Other related posts: