Merge branch 'socket_open_deprecated' of https://github.com/michalpasztamobica/mbed-os into dev_rollup

pull/8838/head
Martin Kojtal 2018-11-23 18:38:02 +00:00
commit b9ea30abf1
4 changed files with 13 additions and 17 deletions

View File

@ -62,7 +62,8 @@ TEST_F(TestTCPSocket, constructor)
TEST_F(TestTCPSocket, constructor_parameters)
{
TCPSocket socketParam = TCPSocket(dynamic_cast<NetworkStack *>(&stack));
TCPSocket socketParam = TCPSocket();
socketParam.open(dynamic_cast<NetworkStack *>(&stack));
const SocketAddress a("127.0.0.1", 1024);
EXPECT_EQ(socketParam.connect(a), NSAPI_ERROR_OK);
}

View File

@ -42,8 +42,14 @@ public:
* network interface.
*
* @param stack Network stack as target for socket
*
* @deprecated since mbed-os-5.11
*/
template <typename S>
MBED_DEPRECATED_SINCE("mbed-os-5.11",
"The TCPSocket(S *stack) constructor is deprecated."
"It discards the open() call return value."
"Use another constructor and call open() explicitly, instead.")
TCPSocket(S *stack)
{
open(stack);

View File

@ -45,22 +45,6 @@ public:
*/
virtual ~TLSSocket();
/** Create a socket on a network interface
*
* Creates and opens a socket on the network stack of the given
* network interface.
* If hostname is also given, user is not required to call set_hostname() later.
*
* @param stack Network stack as target for socket
* @param hostname Hostname used for certificate verification
*/
template <typename S>
TLSSocket(S *stack, const char *hostname = NULL) : TLSSocketWrapper(&tcp_socket, hostname)
{
nsapi_error_t ret = tcp_socket.open(stack);
MBED_ASSERT(ret == NSAPI_ERROR_OK);
}
/** Opens a socket
*
* Creates a network socket on the network stack of the given

View File

@ -41,8 +41,13 @@ public:
*
* @tparam S Type of the Network stack.
* @param stack Network stack as target for socket.
* @deprecated since mbed-os-5.11
*/
template <typename S>
MBED_DEPRECATED_SINCE("mbed-os-5.11",
"The UDPSocket(S *stack) constructor is deprecated"
"It discards the open() call return value."
"Use another constructor and call open() explicitly, instead.")
UDPSocket(S *stack)
{
open(stack);