Skip to content

Commit

Permalink
WiFiClient,WiFiServer: update to match new err_t definition
Browse files Browse the repository at this point in the history
  • Loading branch information
igrr committed Oct 15, 2017
1 parent 1b93218 commit 5116a46
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 19 deletions.
4 changes: 2 additions & 2 deletions libraries/ESP8266WiFi/src/WiFiServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ T* slist_append_tail(T* head, T* item) {
return head;
}

int8_t WiFiServer::_accept(tcp_pcb* apcb, int8_t err) {
long WiFiServer::_accept(tcp_pcb* apcb, long err) {
(void) err;
DEBUGV("WS:ac\r\n");
ClientContext* client = new ClientContext(apcb, &WiFiServer::_s_discard, this);
Expand All @@ -166,7 +166,7 @@ void WiFiServer::_discard(ClientContext* client) {
DEBUGV("WS:dis\r\n");
}

int8_t WiFiServer::_s_accept(void *arg, tcp_pcb* newpcb, int8_t err) {
long WiFiServer::_s_accept(void *arg, tcp_pcb* newpcb, long err) {
return reinterpret_cast<WiFiServer*>(arg)->_accept(newpcb, err);
}

Expand Down
4 changes: 2 additions & 2 deletions libraries/ESP8266WiFi/src/WiFiServer.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ class WiFiServer : public Server {
using Print::write;

protected:
int8_t _accept(tcp_pcb* newpcb, int8_t err);
long _accept(tcp_pcb* newpcb, long err);
void _discard(ClientContext* client);

static int8_t _s_accept(void *arg, tcp_pcb* newpcb, int8_t err);
static long _s_accept(void *arg, tcp_pcb* newpcb, long err);
static void _s_discard(void* server, ClientContext* ctx);
};

Expand Down
24 changes: 9 additions & 15 deletions libraries/ESP8266WiFi/src/include/ClientContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,6 @@ typedef void (*discard_cb_t)(void*, ClientContext*);
extern "C" void esp_yield();
extern "C" void esp_schedule();

#ifdef LWIP_OPEN_SRC
typedef err_t recv_ret_t;
#else
typedef int32_t recv_ret_t;
#endif

#include "DataSource.h"

class ClientContext
Expand All @@ -45,7 +39,7 @@ class ClientContext
{
tcp_setprio(pcb, TCP_PRIO_MIN);
tcp_arg(pcb, this);
tcp_recv(pcb, (tcp_recv_fn) &_s_recv);
tcp_recv(pcb, &_s_recv);
tcp_sent(pcb, &_s_sent);
tcp_err(pcb, &_s_error);
tcp_poll(pcb, &_s_poll, 1);
Expand Down Expand Up @@ -78,7 +72,7 @@ class ClientContext
tcp_poll(_pcb, NULL, 0);
err = tcp_close(_pcb);
if(err != ERR_OK) {
DEBUGV(":tc err %d\r\n", err);
DEBUGV(":tc err %d\r\n", (int) err);
tcp_abort(_pcb);
err = ERR_ABRT;
}
Expand Down Expand Up @@ -126,7 +120,7 @@ class ClientContext

int connect(ip_addr_t* addr, uint16_t port)
{
err_t err = tcp_connect(_pcb, addr, port, reinterpret_cast<tcp_connected_fn>(&ClientContext::_s_connected));
err_t err = tcp_connect(_pcb, addr, port, &ClientContext::_s_connected);
if (err != ERR_OK) {
return 0;
}
Expand Down Expand Up @@ -396,7 +390,7 @@ class ClientContext
break;
}
err_t err = tcp_write(_pcb, buf, next_chunk, TCP_WRITE_FLAG_COPY);
DEBUGV(":wrc %d %d %d\r\n", next_chunk, will_send, err);
DEBUGV(":wrc %d %d %d\r\n", next_chunk, will_send, (int) err);
_datasource->release_buffer(buf, next_chunk);
if (err == ERR_OK) {
_written += next_chunk;
Expand Down Expand Up @@ -456,7 +450,7 @@ class ClientContext
}
}

recv_ret_t _recv(tcp_pcb* pcb, pbuf* pb, err_t err)
err_t _recv(tcp_pcb* pcb, pbuf* pb, err_t err)
{
(void) pcb;
(void) err;
Expand All @@ -481,7 +475,7 @@ class ClientContext
void _error(err_t err)
{
(void) err;
DEBUGV(":er %d %08x\r\n", err, (uint32_t) _datasource);
DEBUGV(":er %d 0x%08x\r\n", (int) err, (uint32_t) _datasource);
tcp_arg(_pcb, NULL);
tcp_sent(_pcb, NULL);
tcp_recv(_pcb, NULL);
Expand All @@ -490,7 +484,7 @@ class ClientContext
_notify_error();
}

int8_t _connected(void* pcb, int8_t err)
err_t _connected(struct tcp_pcb *pcb, err_t err)
{
(void) err;
assert(pcb == _pcb);
Expand All @@ -505,7 +499,7 @@ class ClientContext
return ERR_OK;
}

static recv_ret_t _s_recv(void *arg, struct tcp_pcb *tpcb, struct pbuf *pb, err_t err)
static err_t _s_recv(void *arg, struct tcp_pcb *tpcb, struct pbuf *pb, err_t err)
{
return reinterpret_cast<ClientContext*>(arg)->_recv(tpcb, pb, err);
}
Expand All @@ -525,7 +519,7 @@ class ClientContext
return reinterpret_cast<ClientContext*>(arg)->_sent(tpcb, len);
}

static int8_t _s_connected(void* arg, void* pcb, int8_t err)
static err_t _s_connected(void* arg, struct tcp_pcb *pcb, err_t err)
{
return reinterpret_cast<ClientContext*>(arg)->_connected(pcb, err);
}
Expand Down

0 comments on commit 5116a46

Please sign in to comment.