Simplify net_accept() with UDP sockets

This is made possible by the new API where net_accept() gets a pointer to
bind_ctx, so it can update it.
This commit is contained in:
Manuel Pégourié-Gonnard 2015-07-01 01:28:24 +02:00
parent db2468d7aa
commit abc729e664
6 changed files with 26 additions and 48 deletions
programs/ssl

View file

@ -1896,28 +1896,6 @@ reset:
mbedtls_printf( " ok\n" );
/*
* With UDP, bind_fd is hijacked by client_fd, so bind a new one
*/
#if defined(MBEDTLS_SSL_PROTO_DTLS)
if( opt.transport == MBEDTLS_SSL_TRANSPORT_DATAGRAM )
{
mbedtls_printf( " . Re-bind on udp://%s:%s/ ...",
opt.server_addr ? opt.server_addr : "*",
opt.server_port );
fflush( stdout );
if( ( ret = mbedtls_net_bind( &listen_fd, opt.server_addr,
opt.server_port, MBEDTLS_NET_PROTO_UDP ) ) != 0 )
{
mbedtls_printf( " failed\n ! mbedtls_net_bind returned -0x%x\n\n", -ret );
goto exit;
}
mbedtls_printf( " ok\n" );
}
#endif /* MBEDTLS_SSL_PROTO_DTLS */
/*
* 4. Handshake
*/