Skip to content

Commit 1e659ab

Browse files
kjbracey0xc0170
authored andcommitted
Connectivity test: don't create interface object twice
1 parent 073658e commit 1e659ab

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

TESTS/netsocket/connectivity/main.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,18 @@
2727

2828
using namespace utest::v1;
2929

30+
// Avoid creating the interface twice
31+
static NetworkInterface *get_interface()
32+
{
33+
static NetworkInterface *interface = MBED_CONF_APP_OBJECT_CONSTRUCTION;
34+
35+
return interface;
36+
}
37+
3038
// Bringing the network up and down
3139
template <int COUNT>
3240
void test_bring_up_down() {
33-
NetworkInterface* net = MBED_CONF_APP_OBJECT_CONSTRUCTION;
41+
NetworkInterface* net = get_interface();
3442

3543
for (int i = 0; i < COUNT; i++) {
3644
int err = MBED_CONF_APP_CONNECT_STATEMENT;

0 commit comments

Comments
 (0)