Mark, The problem with select() becoming invalid when the task is killed can be avoided by never killing the task. I assume that is the case for NetManTask with mongoose. You're right that we could fold the listen/accept functionality from TelnetServer task and SSHServer task into NetManTask. When I started with Telnet that option hadn't been created yet and I assumed that the TelnetServer task should not live all the time. I replicated the Telnet design for SSH, but these could be changed. Let me take a look at how to do this. I believe we still need dedicated tasks for the consoles to handle synchronization of output. And we can't just wait on select for these because we also need to wait for Queue events that are the signals for logging output from other tasks. -- Steve On Thu, 16 Nov 2017, Mark Webb-Johnson wrote:
We don't seem to have this issue with the webserver listener; that uses mongoose (in netmanager). That doesn't have long-lived client side connections, but the socket listen/accept functionality should be similar. Not sure how mongoose handles it internally, but the library seems quite robust.
I'm wondering if we can migrate to use that? It would probably save a bunch of ram (as it doesn't need a task for each thread). We are mostly single-user anyway.
Perhaps a generic extension to ovms_netmanager where you give it a tcp port and an object type. Then, it listens on that port and launches objects of that type (pre-configured to receive mongoose events as appropriate) for each new connection? Have a base virtual connection class, that gets inherited by each implementation (ssh, telnet, etc).
I'm happy to try to re-work telnet that way, as an example, if it makes sense to you.
Regards, Mark.