Closed Eze-DP closed 1 year ago
Hi Ezequiel, would you be able to recreate this unwanted behavior using the libssh.org library on your computer? I think the best place to discuss this is on the libssh mailing list -- unless it is specific to this ESP32 port.
Oops, I brought it here because I was working with this library on an ESP32, but now I have checked the libssh.org repository and have confirmed this issue is present in there as well. I will pass it on to their mailing list as you suggested!
If we are interested in simultaneously accepting multiple different channels, say channel A and channel B (different destination ports), we might have threads iterating and checking the session to see if the channel is ready. However, if we execute the ssh_channel_accept() command for channel B when the next message in the library iterator corresponds to channel A, the library will delete the message in the iterator. I propose that the library first checks if the destination port of the message on the iterator matches the function call, and only if it matches should it execute the remainder of the code. For example:
So the difference I have made is the addition of the 'mem' variable which is used to ensure messages are only discarded if it is appropriate.