On Sun, 19 Nov 2017, Stephen Casner wrote:
It seems that it would not that difficult for mg_send() to use a no-wait select() to check whether the socket is available for writing, and if so, to proceed with actually sending it. This could block if the buffer space in the network stack is less than what mg_send() has accumulated, but in most cases it would not block.
I've gone ahead and implemented this change to Mongoose because without it the SSH connection can suffer a badly formed packet and hang due to running out of dynamic memory. I have completed and committed the changes for the Telnet and SSH consoles to no longer create any tasks of their own but instead to run as part of the NetManTask. When there is no connection, this only saves about 1KB because I needed to bump up the stack size for the NetManTask to avoid overflow with the additional complexity of executing the console command code. However, when an SSH connection is established, the reduction in RAM using is about 7KB. -- Steve