-
Notifications
You must be signed in to change notification settings - Fork 638
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Telnet server: alternative to ESPAsyncTCP #1799
Conversation
I will try this later today, but I think there are two issues:
edit: and just to be clear, logging part is easily fixed externally, if debugSend uses internal buffering and flushes inside loop()
|
@Niek @mcspr why this is needed? I'm not an expert and I don't try to disagree with the changes, but I want to understand why this is needed and what benefits it has. |
@Misiu ESPAsyncTCP has not been updated in over a year. It also doesn't play well with Arduino core >= 2.5 especially on the SSL side of things. Someone made a fork to work with BearSSL (https://github.com/Adam5Wu/ESPAsyncTCP) but it requires a bunch other forked stuff like the Arduino core and it hasn't been updated in a year either. @mcspr can you elaborate on the first point? I don't seem to run any issues with logging (but in my tests I'm not using any ESPAsyncTCP modules). The 2048 char array is way overkill indeed for incoming data, maybe we can limit it to 512 or something similar. |
Practical reason is to allow to build without it (using pubsubclient for mqtt, for example) and possibly use Core's server + BearSSL. Not yet though, and I kind of missed removal of the existing one. @Niek We might want to guard new telnet server the same way as #1751 , eg TELNET_SERVER == ... not to get ot... 🉑 Async stuff is kind of cool, but sometimes we hit surprising things that were either already handled by WiFiClient abstraction1 or completely avoided by it. One benefit, however, since we implement it :) - we can fix some quicks between Core versions, while this still applies. We kind of have two ways now - create more robust approach for clients / servers than current one e.g. manually supply all callbacks and streamline buffering (AsyncPrinter / AsyncBufferred... ?). Or just use WiFiClient stuff and try to not do all network activity all at once. Or, maybe try to patch Core WiFiClient::write timeouts to make them behave the same way AsyncClient::write does - just try to write something to the network layer and do nothing otherwise (if there's already too much stuff). I think I saw some issues at the esp8266/Arduino, but not much traction there. Wonder how hard it is. |
I have updated the PR, supporting 2 telnet server implementations now. I tested a lot and it seems to work fine on my setup - please review. |
Regarding client timeout - it does not disconnect and only indication of any problems is write() returning 0. You can try running telnet client on a phone, for example, and disconnect WiFi connection. After running |
The docs mention using I haven't been able to get it to work though (always seem to return true). |
IDK why travis does not pick up the latest commit when restarting the PR build. |
Seems like a Travis CI issue. Do you have rights to restart jobs? In any case, yes this can be merged, we'll figure out the timeout later. |
I pushed a last fix now (allocate only required buffer, not 512 chars] - travis also succeeded this time. |
And following up on the #1799 (comment) (since we don't track ESPAsyncTCP issue yet and this is not really worth mentioning in the library issue tracker)... I have a sort-of working bearssl port based on the work from the https://github.com/Adam5Wu/ESPAsyncTCP Turns out, insecure option is a Core-specific thing. But, it can be safely used just by adding 2 declarations so they get linked from the Core's WiFiClient helpers
|
@mcspr - could you point me to more information on this. I recently posted a PR at me-no-dev/ESPAsyncTCP, I fixed numerous problems in TCPAsyncTCP and SyncClient. Many of the issues in SyncClient were generic in nature and were applied to the other modules; however, there wasn't any test code to verify the results. |
My bad! I read the me-no-dev/ESPAsyncTCP#115 patch briefly a couple of days ago and made a mental note about those classes for some reason. I do see now that those changes are for the default values, so disregard my previous comment. |
This is a rewrite of the telnet module, it's no longer using ESPAsyncTCP but the regular WiFiServer/WiFiClient libraries. Tested it quite a bit, but more testing and feedback is appreciated.