[zeromq-dev] zmq and abstract unix domain sockets

Dhammika Pathirana dhammika at gmail.com
Mon Dec 13 07:43:00 CET 2010


Hi Martin,

On Sun, Dec 12, 2010 at 3:08 AM, Martin Sustrik <sustrik at 250bpm.com> wrote:
> Hi Dhammika,
>
> I've checked this patch. See my comments inlines.
>
> Sorry for the delay :( I still have your shutdown patch in the review queue.
> I've checked it once and it seemed to be OK, but the shutdown code is so
> complex that I want to check it once more.
>

I thought my mailer had mangled them.


>
>> *addr_, socklen_t *addr_len_,
>>      }
>>      strcpy (un->sun_path, path_);
>>      un->sun_family = AF_UNIX;
>> -    *addr_len_ = sizeof (sockaddr_un);
>> +    *addr_len_ = sizeof (un->sun_family) + strlen (path_) + 1;
>
> Is it right to create address that is shorter than the stucture designed to
> hold it?
>

This is ok, they had a macro for this.


> And even if so, why is it necessary in the first place. If it works OK,
> let's rather let is be so that we don't break the behaviour on some exotic
> system.
>

Yes, sockaddr_un is more portable.


>>
>>          //  Bind the socket to the file path.
>> -        rc = bind (s, (struct sockaddr*)&addr, sizeof (sockaddr_un));
>> +        rc = bind (s, (struct sockaddr*)&addr, addr_len);
>>          if (rc != 0) {
>> -            close ();
>> +            close (false);
>
> I would rather have a member variable, say "bool file_exists" that would be
> set after the bind and used in the close function, rather than passing it as
> an argument. What do you think?
>

ok, I'll send a new patch.


Dhammika



More information about the zeromq-dev mailing list