Skip to content

Commit 695e872

Browse files
committed
Correct NetworkStackWrapper::get_ip_address
Previous change that removed string-based APIs missed `NetworkStackWrapper::get_ip_address`. Remove string-based method (which is not overriding anything in `NetworkStack`) and add missing binary form to implement `NetworkStack::get_ip_address`.
1 parent 8f1bf96 commit 695e872

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

features/netsocket/NetworkStack.cpp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -235,17 +235,15 @@ class NetworkStackWrapper : public NetworkStack {
235235
}
236236

237237
public:
238-
using NetworkStack::get_ip_address;
239-
using NetworkStack::gethostbyname;
240-
virtual const char *get_ip_address()
238+
virtual nsapi_error_t get_ip_address(SocketAddress *address)
241239
{
242240
if (!_stack_api()->get_ip_address) {
243-
return 0;
241+
return NSAPI_ERROR_UNSUPPORTED;
244242
}
245243

246-
static uint8_t buffer[sizeof(SocketAddress)];
247-
SocketAddress *address = new (buffer) SocketAddress(_stack_api()->get_ip_address(_stack()));
248-
return address->get_ip_address();
244+
*address = SocketAddress(_stack_api()->get_ip_address(_stack()));
245+
246+
return *address ? NSAPI_ERROR_OK : NSAPI_ERROR_NO_ADDRESS;
249247
}
250248

251249
virtual nsapi_error_t gethostbyname(const char *name, SocketAddress *address, nsapi_version_t version, const char *interface_name)

0 commit comments

Comments
 (0)