bug-apl
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-apl] Solved: Unix socket connection failed


From: Elias Mårtenson
Subject: Re: [Bug-apl] Solved: Unix socket connection failed
Date: Thu, 24 Jul 2014 19:34:53 +0800

I did not know about that feature. Interesting. Also interesting that it's not supported on OSX.

That said, I still think Unix domain sockets are good in this case. There are just a few things that needs to be done in order to make them solid. I think I did most of those things in the native code for the Emacs mode.

These things include:
What do you think of this?

Regards,
Elias


On 24 July 2014 19:26, Juergen Sauermann <address@hidden> wrote:
Hi Elias,

the idea is this:
 
man 7 unix says:

 abstract:  an  abstract  socket address is distinguished by the fact
          that sun_path[0] is a null byte ('\0').   The  socket's  address  in
          this namespace is given by the additional bytes in sun_path that are
          covered by the specified length of  the  address  structure.   (Null
          bytes  in  the  name have no special significance.)

So I memset() the entire socket address first and then copy the name to sun_path,
but starting at  sun_path[1] so that sun_path[0] remains 0 (making it an abstract
socket).

man 7 unix also says:

The abstract socket namespace is a nonportable Linux extension.

That's why I #define ABSTRACT_OFFSET to 1 if your OS supports it and
you can change it to 0 if not. In the latter case you have to provide a file
/tmp/GNU-APL/APserver manually with proper permissions.

This file is having the file permissions that you were after earlier. I am
not creating that file because I expect more problems with it than benefits
(who owns it, who installs it, what if one user creates it with wrong permissions etc.).

My general feeling is that TCP on localhost is much cleaner and maybe I should make
that the default.

/// Jürgen



On 07/24/2014 12:59 PM, Elias Mårtenson wrote:
Sorry, I accidentally hit send… Here's the rest:

In the following call can be found in bot Svar_DB.cc and the APserver, you can find the following:

    strcpy(remote.sun_path + ABSTRACT_OFFSET, server_sockname);

ABSTRACT_OFFSET is #defined to 1. This means that the first character of the path will be 0 (there is a memset() before), and of course the call to bind() will fail.

Removing the addition of ABSTRACT_OFFSET will fix the problem.

I've been looking at the code and I have been trying to figure out why the code was written in this way to begin with. Any ideas?

Regards,
Elias


On 24 July 2014 18:55, Elias Mårtenson <address@hidden> wrote:
I had never been able to get APserver to work properly, and particularly not with the Unix Domain Sockets.

But, I finally figured it out. :-)

In the following call can be found in bot Svar_DB.cc and the APserver.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]