mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-17 22:23:10 +03:00
Imported Ehternet memory-leak fix into sam
This commit is contained in:
@ -43,6 +43,7 @@ int DhcpClass::request_DHCP_lease(){
|
|||||||
_dhcpTransactionId = random(1UL, 2000UL);
|
_dhcpTransactionId = random(1UL, 2000UL);
|
||||||
_dhcpInitialTransactionId = _dhcpTransactionId;
|
_dhcpInitialTransactionId = _dhcpTransactionId;
|
||||||
|
|
||||||
|
_dhcpUdpSocket.stop();
|
||||||
if (_dhcpUdpSocket.begin(DHCP_CLIENT_PORT) == 0)
|
if (_dhcpUdpSocket.begin(DHCP_CLIENT_PORT) == 0)
|
||||||
{
|
{
|
||||||
// Couldn't get a socket
|
// Couldn't get a socket
|
||||||
|
@ -10,7 +10,9 @@ uint16_t EthernetClass::_server_port[MAX_SOCK_NUM] = {
|
|||||||
|
|
||||||
int EthernetClass::begin(uint8_t *mac_address)
|
int EthernetClass::begin(uint8_t *mac_address)
|
||||||
{
|
{
|
||||||
_dhcp = new DhcpClass();
|
static DhcpClass s_dhcp;
|
||||||
|
_dhcp = &s_dhcp;
|
||||||
|
|
||||||
|
|
||||||
// Initialise the basic info
|
// Initialise the basic info
|
||||||
W5100.init();
|
W5100.init();
|
||||||
@ -59,7 +61,6 @@ void EthernetClass::begin(uint8_t *mac_address, IPAddress local_ip, IPAddress dn
|
|||||||
void EthernetClass::begin(uint8_t *mac, IPAddress local_ip, IPAddress dns_server, IPAddress gateway, IPAddress subnet)
|
void EthernetClass::begin(uint8_t *mac, IPAddress local_ip, IPAddress dns_server, IPAddress gateway, IPAddress subnet)
|
||||||
{
|
{
|
||||||
W5100.init();
|
W5100.init();
|
||||||
|
|
||||||
W5100.setMACAddress(mac);
|
W5100.setMACAddress(mac);
|
||||||
W5100.setIPAddress(local_ip._address);
|
W5100.setIPAddress(local_ip._address);
|
||||||
W5100.setGatewayIp(gateway._address);
|
W5100.setGatewayIp(gateway._address);
|
||||||
|
Reference in New Issue
Block a user