mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-06 05:21:22 +03:00
WiFiClient,WiFiServer: update to match new err_t definition
This commit is contained in:
parent
1b932181bd
commit
5116a46f09
@ -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);
|
||||
@ -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);
|
||||
}
|
||||
|
||||
|
@ -62,10 +62,10 @@ public:
|
||||
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);
|
||||
};
|
||||
|
||||
|
@ -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
|
||||
@ -45,7 +39,7 @@ public:
|
||||
{
|
||||
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);
|
||||
@ -78,7 +72,7 @@ public:
|
||||
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;
|
||||
}
|
||||
@ -126,7 +120,7 @@ public:
|
||||
|
||||
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;
|
||||
}
|
||||
@ -396,7 +390,7 @@ protected:
|
||||
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;
|
||||
@ -456,7 +450,7 @@ protected:
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
@ -481,7 +475,7 @@ protected:
|
||||
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);
|
||||
@ -490,7 +484,7 @@ protected:
|
||||
_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);
|
||||
@ -505,7 +499,7 @@ protected:
|
||||
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);
|
||||
}
|
||||
@ -525,7 +519,7 @@ protected:
|
||||
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);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user