On 27.01.19 19:10, g4-l...@tonarchiv.ch wrote: > > On 24.01.19 15:56, g4-l...@tonarchiv.ch 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. > It seems that I'm the only one using connectors. In the few samples I found it's only used to read/write from/to console. So the stdin and -out file handles don't need explicit close / EOF, hence the issue from above is not relevant.
Now I also found what I think is a bug in the connector API. Anyone interested in this? Ok I guess I open a new "thread" on this - I also have a simple patch for it. Cheers, Till