Skip to content

Commit fb3a8a0

Browse files
committed
WiFiClient,WiFiServer: update to match new err_t definition
1 parent 39e6559 commit fb3a8a0

File tree

3 files changed

+13
-19
lines changed

3 files changed

+13
-19
lines changed

Diff for: libraries/ESP8266WiFi/src/WiFiServer.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ T* slist_append_tail(T* head, T* item) {
151151
return head;
152152
}
153153

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

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

Diff for: libraries/ESP8266WiFi/src/WiFiServer.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,10 @@ class WiFiServer : public Server {
6262
using Print::write;
6363

6464
protected:
65-
int8_t _accept(tcp_pcb* newpcb, int8_t err);
65+
long _accept(tcp_pcb* newpcb, long err);
6666
void _discard(ClientContext* client);
6767

68-
static int8_t _s_accept(void *arg, tcp_pcb* newpcb, int8_t err);
68+
static long _s_accept(void *arg, tcp_pcb* newpcb, long err);
6969
static void _s_discard(void* server, ClientContext* ctx);
7070
};
7171

Diff for: libraries/ESP8266WiFi/src/include/ClientContext.h

+9-15
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,6 @@ typedef void (*discard_cb_t)(void*, ClientContext*);
2929
extern "C" void esp_yield();
3030
extern "C" void esp_schedule();
3131

32-
#ifdef LWIP_OPEN_SRC
33-
typedef err_t recv_ret_t;
34-
#else
35-
typedef int32_t recv_ret_t;
36-
#endif
37-
3832
#include "DataSource.h"
3933

4034
class ClientContext
@@ -45,7 +39,7 @@ class ClientContext
4539
{
4640
tcp_setprio(pcb, TCP_PRIO_MIN);
4741
tcp_arg(pcb, this);
48-
tcp_recv(pcb, (tcp_recv_fn) &_s_recv);
42+
tcp_recv(pcb, &_s_recv);
4943
tcp_sent(pcb, &_s_sent);
5044
tcp_err(pcb, &_s_error);
5145
tcp_poll(pcb, &_s_poll, 1);
@@ -78,7 +72,7 @@ class ClientContext
7872
tcp_poll(_pcb, NULL, 0);
7973
err = tcp_close(_pcb);
8074
if(err != ERR_OK) {
81-
DEBUGV(":tc err %d\r\n", err);
75+
DEBUGV(":tc err %d\r\n", (int) err);
8276
tcp_abort(_pcb);
8377
err = ERR_ABRT;
8478
}
@@ -126,7 +120,7 @@ class ClientContext
126120

127121
int connect(ip_addr_t* addr, uint16_t port)
128122
{
129-
err_t err = tcp_connect(_pcb, addr, port, reinterpret_cast<tcp_connected_fn>(&ClientContext::_s_connected));
123+
err_t err = tcp_connect(_pcb, addr, port, &ClientContext::_s_connected);
130124
if (err != ERR_OK) {
131125
return 0;
132126
}
@@ -396,7 +390,7 @@ class ClientContext
396390
break;
397391
}
398392
err_t err = tcp_write(_pcb, buf, next_chunk, TCP_WRITE_FLAG_COPY);
399-
DEBUGV(":wrc %d %d %d\r\n", next_chunk, will_send, err);
393+
DEBUGV(":wrc %d %d %d\r\n", next_chunk, will_send, (int) err);
400394
_datasource->release_buffer(buf, next_chunk);
401395
if (err == ERR_OK) {
402396
_written += next_chunk;
@@ -456,7 +450,7 @@ class ClientContext
456450
}
457451
}
458452

459-
recv_ret_t _recv(tcp_pcb* pcb, pbuf* pb, err_t err)
453+
err_t _recv(tcp_pcb* pcb, pbuf* pb, err_t err)
460454
{
461455
(void) pcb;
462456
(void) err;
@@ -481,7 +475,7 @@ class ClientContext
481475
void _error(err_t err)
482476
{
483477
(void) err;
484-
DEBUGV(":er %d %08x\r\n", err, (uint32_t) _datasource);
478+
DEBUGV(":er %d 0x%08x\r\n", (int) err, (uint32_t) _datasource);
485479
tcp_arg(_pcb, NULL);
486480
tcp_sent(_pcb, NULL);
487481
tcp_recv(_pcb, NULL);
@@ -490,7 +484,7 @@ class ClientContext
490484
_notify_error();
491485
}
492486

493-
int8_t _connected(void* pcb, int8_t err)
487+
err_t _connected(struct tcp_pcb *pcb, err_t err)
494488
{
495489
(void) err;
496490
assert(pcb == _pcb);
@@ -505,7 +499,7 @@ class ClientContext
505499
return ERR_OK;
506500
}
507501

508-
static recv_ret_t _s_recv(void *arg, struct tcp_pcb *tpcb, struct pbuf *pb, err_t err)
502+
static err_t _s_recv(void *arg, struct tcp_pcb *tpcb, struct pbuf *pb, err_t err)
509503
{
510504
return reinterpret_cast<ClientContext*>(arg)->_recv(tpcb, pb, err);
511505
}
@@ -525,7 +519,7 @@ class ClientContext
525519
return reinterpret_cast<ClientContext*>(arg)->_sent(tpcb, len);
526520
}
527521

528-
static int8_t _s_connected(void* arg, void* pcb, int8_t err)
522+
static err_t _s_connected(void* arg, struct tcp_pcb *pcb, err_t err)
529523
{
530524
return reinterpret_cast<ClientContext*>(arg)->_connected(pcb, err);
531525
}

0 commit comments

Comments
 (0)