-
Notifications
You must be signed in to change notification settings - Fork 7.5k
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
WiFiClient - rename flush() to clear() (breaking) #8871
Conversation
My concern with
To be honest, your replacement of the flush function for the WiFiClient is more like a flush and not a clear as you actually actively flush some buffer. |
I renamed the EDIT: I removed the change from WiFiClientSecure. It was change "no change". |
2cc2b73
to
bd5fe04
Compare
Added "breaking change" label due to the PR name, please validate it @SuGlider. |
Arduino.cc API uses flush (https://www.arduino.cc/reference/en/libraries/wifi/client.flush/), we should keep it. At this point, it does NOT make sense to merge this PR. Anyway, thanks for your proposal @JAndrassy. |
that documentation is wrong. related #943 |
The documentation reflects |
sorry but https://www.arduino.cc/reference/en/libraries/wifi/client.flush/ is the documentation of the old and obsolete Arduino WiFi library written in 2011. WiFiNINA documentation has other nonsens but talks about TX.
Arduino release notes 1.0 - 2011.11.30:
Arduino release notes 1.6.7 - 2015.12.17
I analyzed the API of 18 Arduino networking libraries. ESP32 is the only one with wrong implementation of |
@JAndrassy I see, thanks a lot for the references, we will take a look! |
I for sure see the significant difference and for sure I would expect a flush to actually transmit data which is in the TX buffers instead of dropping. Conceptually, when calling flush, the buffers are empty after this call. From a usecase point of view, I may have a sensor which sends data which I'm not interested in. To give a more concrete example which is quite timing critical and doesn't need to actually send a pulse is receiving GPS data. Another example is when multiplexing the same serial port for several sensors which only send data and need no command to trigger sending data. N.B. I know the examples above are about the serial port and not WiFiClient, but the principle remains the same. TL;DR As I mentioned before (in other discussions), I can totally see why functions used all over the Arduino landscape should act predictable and similar. |
These all do flush the output buffers, which makes perfect sense. My point is about the meaning of the word flush regarding input buffers. I did a quick look again at the PR code and noticed you did just change the function names of flush to clear, without looking further to what was actually done. I still stand by what I have written, but I also have to conclude this was a matter of "disagree to agree" (from my part). So to conclude, I think it is wise to actually rename and/or split (where appropriate) |
I would even recommend to remove the 'clear' functions. Clearing the input blindly is not a good idea. |
|
Hello @JAndrassy, ipv6 have been merged, the main work is now being done in Networking refactoring PR, please refer to that one. Thanks |
that doesn't change the WiFiClient API |
@me-no-dev maybe look at this one too |
With a major version release the
flush()
dilemma could be resolved for WiFiClient & co. as last on this platform.If Arduino adds to Stream a method to clear the input buffer, it will be most probably named
clear
becauseStream
is taken from Processing and there it hasclear()
.