Skip to content

Commit a38dbba

Browse files
committed
Fixed small issues revealed in tests
- Default argument for gethostbyname missing - Fixed invalid return value for close on unconnected socket
1 parent d4cafb5 commit a38dbba

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

ESP8266Interface.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,10 +210,11 @@ int ESP8266Interface::socket_close(void *handle)
210210
int err = 0;
211211
_esp.setTimeout(ESP8266_MISC_TIMEOUT);
212212

213-
if (!_esp.close(socket->id)) {
213+
if (socket->connected && !_esp.close(socket->id)) {
214214
err = NSAPI_ERROR_DEVICE_ERROR;
215215
}
216216

217+
socket->connected = false;
217218
_ids[socket->id] = false;
218219
delete socket;
219220
return err;

ESP8266Interface.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ class ESP8266Interface : public NetworkStack, public WiFiInterface
7070
* version is chosen by the stack (defaults to NSAPI_UNSPEC)
7171
* @return 0 on success, negative error code on failure
7272
*/
73-
virtual nsapi_error_t gethostbyname(const char *name, SocketAddress *address, nsapi_version_t version);
73+
virtual nsapi_error_t gethostbyname(const char *name, SocketAddress *address, nsapi_version_t version = NSAPI_UNSPEC);
7474

7575
/** Set the WiFi network credentials
7676
*

0 commit comments

Comments
 (0)