Skip to content

Commit b9ea30a

Browse files
committed
Merge branch 'socket_open_deprecated' of https://github.com/michalpasztamobica/mbed-os into dev_rollup
2 parents 36bc2ef + 42940fa commit b9ea30a

File tree

4 files changed

+13
-17
lines changed

4 files changed

+13
-17
lines changed

UNITTESTS/features/netsocket/TCPSocket/test_TCPSocket.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ TEST_F(TestTCPSocket, constructor)
6262

6363
TEST_F(TestTCPSocket, constructor_parameters)
6464
{
65-
TCPSocket socketParam = TCPSocket(dynamic_cast<NetworkStack *>(&stack));
65+
TCPSocket socketParam = TCPSocket();
66+
socketParam.open(dynamic_cast<NetworkStack *>(&stack));
6667
const SocketAddress a("127.0.0.1", 1024);
6768
EXPECT_EQ(socketParam.connect(a), NSAPI_ERROR_OK);
6869
}

features/netsocket/TCPSocket.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,14 @@ class TCPSocket : public InternetSocket {
4242
* network interface.
4343
*
4444
* @param stack Network stack as target for socket
45+
*
46+
* @deprecated since mbed-os-5.11
4547
*/
4648
template <typename S>
49+
MBED_DEPRECATED_SINCE("mbed-os-5.11",
50+
"The TCPSocket(S *stack) constructor is deprecated."
51+
"It discards the open() call return value."
52+
"Use another constructor and call open() explicitly, instead.")
4753
TCPSocket(S *stack)
4854
{
4955
open(stack);

features/netsocket/TLSSocket.h

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -45,22 +45,6 @@ class TLSSocket : public TLSSocketWrapper {
4545
*/
4646
virtual ~TLSSocket();
4747

48-
/** Create a socket on a network interface
49-
*
50-
* Creates and opens a socket on the network stack of the given
51-
* network interface.
52-
* If hostname is also given, user is not required to call set_hostname() later.
53-
*
54-
* @param stack Network stack as target for socket
55-
* @param hostname Hostname used for certificate verification
56-
*/
57-
template <typename S>
58-
TLSSocket(S *stack, const char *hostname = NULL) : TLSSocketWrapper(&tcp_socket, hostname)
59-
{
60-
nsapi_error_t ret = tcp_socket.open(stack);
61-
MBED_ASSERT(ret == NSAPI_ERROR_OK);
62-
}
63-
6448
/** Opens a socket
6549
*
6650
* Creates a network socket on the network stack of the given

features/netsocket/UDPSocket.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,13 @@ class UDPSocket : public InternetSocket {
4141
*
4242
* @tparam S Type of the Network stack.
4343
* @param stack Network stack as target for socket.
44+
* @deprecated since mbed-os-5.11
4445
*/
4546
template <typename S>
47+
MBED_DEPRECATED_SINCE("mbed-os-5.11",
48+
"The UDPSocket(S *stack) constructor is deprecated"
49+
"It discards the open() call return value."
50+
"Use another constructor and call open() explicitly, instead.")
4651
UDPSocket(S *stack)
4752
{
4853
open(stack);

0 commit comments

Comments
 (0)