1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-04-25 20:02:37 +03:00

Merge branch 'esp8266' of https://github.com/jwatte/Arduino into jwatte-esp8266

This commit is contained in:
Ivan Grokhotkov 2015-05-12 19:11:22 +03:00
commit 720142ef24
3 changed files with 9 additions and 7 deletions

View File

@ -133,14 +133,13 @@ int WiFiUDP::beginPacket(const char *host, uint16_t port)
int WiFiUDP::beginPacket(IPAddress ip, uint16_t port)
{
ip_addr_t addr;
addr.addr = ip;
if (!_ctx) {
_ctx = new UdpContext;
_ctx->ref();
}
return (_ctx->connect(addr, port)) ? 1 : 0;
begunIp_ = ip;
begunPort_= port;
return 1;
}
int WiFiUDP::beginPacketMulticast(IPAddress multicastAddress, uint16_t port,
@ -168,8 +167,9 @@ int WiFiUDP::endPacket()
if (!_ctx)
return 0;
_ctx->send();
_ctx->disconnect();
ip_addr_t addr;
addr.addr = begunIp_;
_ctx->send(&addr, begunPort_);
return 1;
}

View File

@ -31,6 +31,8 @@ class UdpContext;
class WiFiUDP : public UDP {
private:
UdpContext* _ctx;
IPAddress begunIp_;
uint16_t begunPort_;
public:
WiFiUDP(); // Constructor

View File

@ -304,7 +304,7 @@ private:
void _reserve(size_t size)
{
const size_t pbuf_unit_size = 1024;
const size_t pbuf_unit_size = 512;
if (!_tx_buf_head)
{
_tx_buf_head = pbuf_alloc(PBUF_TRANSPORT, pbuf_unit_size, PBUF_RAM);