[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Issues with Connector on net sockets
[Thread Prev] | [Thread Next]
- Subject: Re: Issues with Connector on net sockets
- From: g4-lisz@xxxxxxxxxxxx
- Reply-to: libssh@xxxxxxxxxx
- Date: Sun, 27 Jan 2019 19:10:15 +0100
- To: libssh@xxxxxxxxxx
On 24.01.19 15:56, g4-lisz@xxxxxxxxxxxx wrote: > First of all: Is this supposed to work with more than one channel in a > single event loop? > Short answer: NO. Longer answer: I don't know if it was supposed to work, but it doesn't. At least it does not work when connectors are removed who share the same session. The problem lies in how the session is removed from the polling context: ssh_event_remove_connector() --> ssh_connector_remove_event(): if (connector->in_channel != NULL) { session = ssh_channel_get_session(connector->in_channel); ssh_event_remove_session(connector->event, session); connector->in_channel = NULL; } if (connector->out_channel != NULL) { session = ssh_channel_get_session(connector->out_channel); ssh_event_remove_session(connector->event, session); connector->out_channel = NULL; } connector->event = NULL; So there is the call ssh_event_remove_session(), which removes the session object also used for other connectors. Hence polling for the session stops. One "solution" could be to simply not remove connectors as long as the main loop is running. But his results in another issue: The socket filehandles of a closed net sockets remain in the poll() call, which is not a good idea. Honestly I don't know how to solve this issue. A possible solution could be in counting how many times a session has been added. And then polling object is only removed when counter is on zero. Till ssh_event_remove_session(connector->event, session);
Re: Issues with Connector on net sockets | g4-lisz@xxxxxxxxxxxx |
Issues with Connector on net sockets | g4-lisz@xxxxxxxxxxxx |