Skip to content
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 - don't inherit from Server class #8418

Merged
merged 5 commits into from
Jan 3, 2022
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion libraries/ESP8266WiFi/src/ArduinoWiFiServer.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#endif

template <class TServer, class TClient>
class ArduinoCompatibleWiFiServerTemplate : public TServer {
class ArduinoCompatibleWiFiServerTemplate : public TServer, public Print {
public:

ArduinoCompatibleWiFiServerTemplate(const IPAddress& addr, uint16_t port) : TServer(addr, port) {}
Expand Down
12 changes: 0 additions & 12 deletions libraries/ESP8266WiFi/src/WiFiServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,18 +171,6 @@ void WiFiServer::stop() {
close();
}

size_t WiFiServer::write(uint8_t b) {
return write(&b, 1);
}

size_t WiFiServer::write(const uint8_t *buffer, size_t size) {
// write to all clients
// not implemented
(void) buffer;
(void) size;
return 0;
}

template<typename T>
T* slist_append_tail(T* head, T* item) {
if (!head)
Expand Down
5 changes: 1 addition & 4 deletions libraries/ESP8266WiFi/src/WiFiServer.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ extern "C" {
class ClientContext;
class WiFiClient;

class WiFiServer : public Server {
class WiFiServer {
// Secure server needs access to all the private entries here
protected:
uint16_t _port;
Expand Down Expand Up @@ -94,14 +94,11 @@ class WiFiServer : public Server {
void begin(uint16_t port, uint8_t backlog);
void setNoDelay(bool nodelay);
bool getNoDelay();
virtual size_t write(uint8_t);
virtual size_t write(const uint8_t *buf, size_t size);
uint8_t status();
uint16_t port() const;
void close();
void stop();

using Print::write;
using ClientType = WiFiClient;

protected:
Expand Down
12 changes: 0 additions & 12 deletions tests/host/common/MockWiFiServerSocket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,18 +127,6 @@ bool WiFiServer::hasClient ()
return poll(&p, 1, 0) && p.revents == POLLIN;
}

size_t WiFiServer::write (uint8_t c)
{
return write(&c, 1);
}

size_t WiFiServer::write (const uint8_t *buf, size_t size)
{
fprintf(stderr, MOCK "todo: WiFiServer::write(%p, %zd)\n", buf, size);
exit(EXIT_FAILURE);
return 0;
}

void WiFiServer::close ()
{
if (pcb2int(_listen_pcb) >= 0)
Expand Down