Balazs Scheidler <[EMAIL PROTECTED]> writes:
> I have added some missing bits to tcpforwarding:
> * the forwarded-tcpip channel open request is now filled correctly
> * cancel-forward-tcpip is implemented
> * forwarded-tcpip & cancel-forward-tcpip global requests are now handled if
> WITH_TCPFORWARD_SUPPORT macro is defined (in lshd.c)
Great. I have incorporated the previous patch into my code, but I
haven't been able to check it in yet (network trouble). I hope to get
the time to look at your new code this weekend.
> I have ran into a problem, which may require some modifications to the
> command architecture. I need to cancel forwarded-tcpip requests, which
> requires a close_fd() on the listening fd. I am listening using a
> listen_connection command, and I would have to tell him to cancel the
> pending listen.
>
> I was thinking about an additional method in the command class, which would
> cancel a pending operation. This
I think the problem is that listen command needs to return two values; first
the fd-object it is listening on (or NULL if listen failed); second,
the fd-objects returned from accept. Currently, the first of these are
difficult to get to.
I'm considering changing the listen command and drop the idea that it
_returns_ accepted connections, several times. Instead, you would
invoke a listen-command like
(listen port some-callback)
This command could return the listen-fd (or NULL if unsuccessful). You
could keep a pointer to the object and close it when the forwarding is
cancelled. When a connection is accepted, listen will invoke the
callback with the new fd as argument.
Do you think that would solve the problem? I'm afraid that a cancel
method would make things a lot more complicated.
About changes to the command architecture, there is one other, rather
orthogonal, thing I'm considering. Exceptions. The basic idea is to
pass _two_ continuations when invoking a command. One is used for
returning a value, for succesful completion of the command. The other
is used if the command failes. I think such a mechanism could make
several command related things simpler.
/Niels