-
Notifications
You must be signed in to change notification settings - Fork 13.3k
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
WiFiServer - 'rename' available() to accept() #8419
Conversation
6f368c3
to
09d7e57
Compare
the checks treat (deprecated) warning as errors so I had to replace available() to accept() in libraries and examples. now only the mock test fails with |
diff --git a/tests/host/common/MockWiFiServer.cpp b/tests/host/common/MockWiFiServer.cpp
index 132ca5e8..7b449845 100644
--- a/tests/host/common/MockWiFiServer.cpp
+++ b/tests/host/common/MockWiFiServer.cpp
@@ -55,9 +55,8 @@ WiFiServer::WiFiServer (uint16_t port)
_port = port;
}
-WiFiClient WiFiServer::available (uint8_t* status)
+WiFiClient WiFiServer::accept ()
{
- (void)status;
if (hasClient())
return WiFiClient(new ClientContext(serverAccept(pcb2int(_listen_pcb))));
return WiFiClient(); |
09d7e57
to
8bfd473
Compare
02858cf
to
83e1cd8
Compare
83e1cd8
to
a96309c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, it is not a breaking change but a deprecation.
Per Ethernet.accept()
it seems that our implementation for server::available()
does not comply with Arduino. It was the ::accept()
implementation.
29cabf0
to
ee7aa0e
Compare
ee7aa0e
to
9e52826
Compare
esp8266/Arduino#8419 deprecated WiFiServer::available in favor to WiFiServer::accept.
esp8266/Arduino#8419 deprecated WiFiServer::available in favor to WiFiServer::accept.
* WiFiServer - 'rename' available() to accept() * use server.accept() instead of available() * WiFiServer.accept() and ArduinoWiFiServer class doc update
If this PR gets positive reviews, I will add commits with examples and documentation changes.
The available() method in WiFiServer and WiFiServerSecureBearSSL is not implemented as the available() in the Arduino WiFi library and other WiFi libraries by Arduino. The implementation of available() matches the Ethernet library's accept() method added in 2018.
This PR marks available() in WiFiServer as deprecated and adds the accept() method with implementation identical to available().
My addition to the ESP8266WiFi library, the ArduinoWiFiServer class has available() implemented the Arduino way.