Getting back to this after a while...

> Right. You cannot have two parsers reading from the same socket, nor should
> protocol support be attempting to parse the Guacamole protocol manually. To
> handle argv, you need to provide an argv_handler to the guac_user struct.
> That handler will be called when argv is received.
>

So, I've taken care of the issue of two parsers and am now correctly (I
think) using the argv handler to process received argv instructions.  I see
the argv handler getting called, and it seems to process the correct
setting name, but the data (argument value) doesn't actually seem to be
there (empty or null).  Not sure if I'm doing this incorrectly, but on the
client side I'm doing the following:

$log.debug('Sending response for parameter ' + parameter + ': ' +
JSON.stringify(data[parameter]));
var stream = client.createArgumentValueStream("string", parameter);
var writer = new Guacamole.StringWriter(stream);
writer.sendText(data[parameter]);
writer.sendEnd();
$log.debug('Finished sending response.');

on the server side, like I said, I see the call to the argv handler that
I've written, and it correctly choose the setting, but if I process the
argv->buffer, it's empty??

My admittedly very messy repos are here:

https://github.com/necouchman/guacamole-client/tree/jira/221
https://github.com/necouchman/guacamole-server/tree/jira/221



>
> This probably means that the use of the FreeRDP authentication callback
> > will not work, unless
> > there's some other way to accomplish this.  I could still try to block
> the
> > pthread until the input is received, but this might cause other problems
> on
> > the client side with an unresponsive connection?
> >
>
> If FreeRDP depends on this being synchronous, yes, the handler will need to
> block on some sort of pthread condition which is signalled when the
> credentials are set. Reading of the argv instruction should happen
> magically as long as argv_handler is properly set, as Guacamole protocol
> parsing is handled for you by guacd and libguac in a separate thread.
>
> If blocking will potentially result in the connection going silent, there's
> a function for that - guac_socket_require_keep_alive():
>
>
> http://guacamole.apache.org/doc/libguac/socket_8h.html#a1d8c5111a8234c7785ae23f379f7db03
>
> That will force the guac_socket to send a "nop" instruction roughly every 5
> seconds if nothing else is sent during that period.
>

I think I've managed to take care of this concern - I implemented a
pthread_cond_timedwait() for each of the parameters that get requested, and
then a pthread_cond_broadcast() within the argv handler to signal the
completion.  It's a little hard to tell if it's working properly with the
issues I'm having with data not being sent, but during the prompt I see the
nop debug messages on the server side, and the connection never times out,
so I think it's waiting properly.

Thanks for the hints so far...getting closer... :-)

-Nick

Reply via email to