1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-06-06 05:21:22 +03:00

Merge remote-tracking branch 'remotes/esp8266/esp8266' into esp8266

This commit is contained in:
Markus Sattler 2015-04-14 22:09:50 +02:00
commit 0bfd5cb396

View File

@ -68,9 +68,11 @@ uint8_t WiFiUDP::begin(uint16_t port)
{
if (_ctx) {
_ctx->unref();
_ctx = 0;
}
_ctx = new UdpContext;
_ctx->ref();
ip_addr_t addr;
addr.addr = INADDR_ANY;
return (_ctx->listen(addr, port)) ? 1 : 0;
@ -93,7 +95,7 @@ uint8_t WiFiUDP::beginMulticast(IPAddress interfaceAddr, IPAddress multicast, ui
}
_ctx = new UdpContext;
_ctx->ref();
if (!_ctx->listen(*IP_ADDR_ANY, port)) {
return 0;
}
@ -133,8 +135,10 @@ int WiFiUDP::beginPacket(IPAddress ip, uint16_t port)
ip_addr_t addr;
addr.addr = ip;
if (!_ctx)
if (!_ctx) {
_ctx = new UdpContext;
_ctx->ref();
}
return (_ctx->connect(addr, port)) ? 1 : 0;
}