[RFC] Patch to allow a DBusConnection to be recreated from an fd

Thiago Macieira thiago at kde.org
Tue Mar 5 16:04:32 PST 2013


On terça-feira, 5 de março de 2013 20.40.37, Simon McVittie wrote:
> On 05/03/13 19:26, Thiago Macieira wrote:
> > I don't see any harm in obtaining the connection
> > address, and I do think that creating a connection from an already-opened
> > file descriptor could be very useful. For example, some pre-handshake
> > could be performed on that file descriptor, or it could be transported
> > over something different.
> 
> If we go this route, I'd prefer it to be its own transport similar to
> unixexec - "unixfd:fd=3,state=before_0" or something - rather than
> introducing open_from_fd(), which appears to mean "ignore the address
> parameter and use this fd instead, hopefully they match". It should have
> the same "it's really a socket, not something weird like a pair of
> pipes" property as unixexec.

Well, as long as that can select the correct DBusTransport implementation, it 
should be fine.

> The states through which a D-Bus connection goes are approximately:
> 
> * before initial '\0'
> * after initial '\0' but before SASL (x)
> * during SASL (x)
> * after SASL but before Hello
> * Hello sent, reply with unique name not received (x)
> * between messages
> * during an incoming or outgoing message (x)
> 
> (at the points marked (x), handing off the connection makes little
> sense; included for completeness).

There's one extra step: the feature negotiation, which happens between SASL 
auth and before Hello.

The fact that we can carry the state in the address makes sense to simply 
reuse the existing functions.

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel Open Source Technology Center
      PGP/GPG: 0x6EF45358; fingerprint:
      E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.freedesktop.org/archives/dbus/attachments/20130305/e03aa727/attachment.pgp>


More information about the dbus mailing list