assuan external loop over socket

Marcus Brinkmann marcus.brinkmann at ruhr-uni-bochum.de
Mon Dec 3 16:08:05 CET 2007


At Sun, 2 Dec 2007 12:47:45 -0500,
Ben Kibbey <bjk at luxsci.net> wrote:
> 
> On Fri, Oct 26, 2007 at 03:33:09PM +0200, Marcus Brinkmann wrote:
> > At Thu, 25 Oct 2007 09:59:20 -0400,
> > Ben Kibbey <bjk at luxsci.net> wrote:
> > > 
> > > The assuan info docs say connecting to a socket with the external IO
> > > loop isn't supported. Are there any plans to do this in the near future?
> > 
> > If you need to do asynchronous assuan communication in the client,
> > then yes, there is a small function missing, which I can add easily.
> 
> [...]
> 
> I have a need for this now. I have a client that sends an inquire
> command to the server, but the data needs to be sent ASSUAN_LINELENGTH
> bytes at a time (memory restrictions). assuan_transact() can't do this
> with it's inquire callback and keep parsing status messages from the
> server at the same time, which I also need. I can't call
> assuan_read_line() to do the status line parsing in the inquire callback
> because assuan_read_line() blocks?

Allow me to ask for a clarification: You want to read status messages
*while* you have an inquire operation ongoing?  Normally, assuan
servers do not send status messages while they are receiving inquire
data.  I have never considered this possibility.  It seems overly complex.

The current asynchronous interfaces assume that both client and server
read promptly whenever the other end may send something.  So, you
should be able to write all inquire data in a busy loop without
blocking.

> I'm guessing how the asynchronous client works: If I were to call
> assuan_transact() which would setup the callbacks, then call
> assuan_process_next() until the inquire callback returns EOF, or an
> error, to finish the command. Then call assuan_process_done() to get the
> command result from the server. Is this right?

Well, the assuan_transact function would need to be split up into a
send request phase and a receive reply phase.  I don't think inquire
data should be handled asynchronously.  This would only make sense if
you have a lot of inquire data, and then it makes sense to just use an
input fd for your data.

I don't remember anymore exactly what plans I had for the client side
and asynchronous interfaces.  Probably not much beyond what I wrote
above.

In fact, if you look at GPGME, it uses assuan_transact only for simple
"synchrnous" commands which we know return promptly.  For the main
functions it uses its own implementation of "assuan_transact".  One
might wish for more support from libassuan, but assuan_transact is so
simple, and asynchronous interfaces are so complex, that shifting that
little of the client side which is in libassuan to the application
does not seem overly burdensome.  BUT: I do not use the inquire
feature in GPGME at all, which may make me biased.

I suggest we first clarify which data gets send asynchronously in
which direction under which circumstances first, and then take another
look at the interfaces we might need to touch to make this
easier/possible.

Thanks,
Marcus




More information about the Gnupg-devel mailing list