diff --git a/libfreerdp/core/gateway/rpc.c b/libfreerdp/core/gateway/rpc.c index 4630e1222..f303b8f5e 100644 --- a/libfreerdp/core/gateway/rpc.c +++ b/libfreerdp/core/gateway/rpc.c @@ -771,7 +771,7 @@ int rpc_channel_tls_connect(RpcChannel* channel, int timeout) if (!freerdp_tcp_connect(tcp, settings->GatewayHostname, settings->GatewayPort, timeout)) return -1; - if (!freerdp_tcp_set_blocking_mode(tcp, FALSE)) + if (!BIO_set_nonblock(tcp->socketBio, TRUE)) return -1; tls = channel->tls = tls_new(settings); diff --git a/libfreerdp/core/tcp.c b/libfreerdp/core/tcp.c index 3d4343f2a..578eb28aa 100644 --- a/libfreerdp/core/tcp.c +++ b/libfreerdp/core/tcp.c @@ -1091,11 +1091,6 @@ BOOL freerdp_tcp_connect(rdpTcp* tcp, const char* hostname, int port, int timeou return TRUE; } -BOOL freerdp_tcp_set_blocking_mode(rdpTcp* tcp, BOOL blocking) -{ - return BIO_set_nonblock(tcp->socketBio, blocking ? 0 : 1) ? TRUE : FALSE; -} - BOOL freerdp_tcp_set_keep_alive_mode(rdpTcp* tcp) { #ifndef _WIN32 @@ -1190,14 +1185,6 @@ int freerdp_tcp_attach(rdpTcp* tcp, int sockfd) return 1; } -HANDLE freerdp_tcp_get_event_handle(rdpTcp* tcp) -{ - if (!tcp) - return NULL; - - return tcp->event; -} - int freerdp_tcp_wait_read(rdpTcp* tcp, DWORD dwMilliSeconds) { int status; diff --git a/libfreerdp/core/tcp.h b/libfreerdp/core/tcp.h index 55106edc1..533db8ae5 100644 --- a/libfreerdp/core/tcp.h +++ b/libfreerdp/core/tcp.h @@ -70,14 +70,10 @@ struct rdp_tcp }; BOOL freerdp_tcp_connect(rdpTcp* tcp, const char* hostname, int port, int timeout); -int freerdp_tcp_read(rdpTcp* tcp, BYTE* data, int length); -int freerdp_tcp_write(rdpTcp* tcp, BYTE* data, int length); int freerdp_tcp_wait_read(rdpTcp* tcp, DWORD dwMilliSeconds); int freerdp_tcp_wait_write(rdpTcp* tcp, DWORD dwMilliSeconds); -BOOL freerdp_tcp_set_blocking_mode(rdpTcp* tcp, BOOL blocking); BOOL freerdp_tcp_set_keep_alive_mode(rdpTcp* tcp); int freerdp_tcp_attach(rdpTcp* tcp, int sockfd); -HANDLE freerdp_tcp_get_event_handle(rdpTcp* tcp); rdpTcp* freerdp_tcp_new(rdpSettings* settings); void freerdp_tcp_free(rdpTcp* tcp); diff --git a/libfreerdp/core/transport.c b/libfreerdp/core/transport.c index 06a5f9dd2..ebf841bc1 100644 --- a/libfreerdp/core/transport.c +++ b/libfreerdp/core/transport.c @@ -94,13 +94,13 @@ BOOL transport_connect_tls(rdpTransport* transport) if (transport->GatewayEnabled) { - tls = transport->tls = tls_new(transport->settings); + tls = transport->tls = tls_new(settings); transport->layer = TRANSPORT_LAYER_TSG_TLS; bio = transport->frontBio; } else { - transport->tls = tls_new(settings); + tls = transport->tls = tls_new(settings); transport->layer = TRANSPORT_LAYER_TLS; bio = transport->TcpIn->bufferedBio; } @@ -709,7 +709,7 @@ DWORD transport_get_event_handles(rdpTransport* transport, HANDLE* events) DWORD nCount = 0; if (events) - events[nCount] = freerdp_tcp_get_event_handle(transport->TcpIn); + events[nCount] = transport->TcpIn->event; nCount++; if (transport->ReceiveEvent) @@ -823,16 +823,15 @@ int transport_check_fds(rdpTransport* transport) BOOL transport_set_blocking_mode(rdpTransport* transport, BOOL blocking) { - BOOL status = TRUE; - transport->blocking = blocking; if (!transport->SplitInputOutput) { - status &= freerdp_tcp_set_blocking_mode(transport->TcpIn, blocking); + if (!BIO_set_nonblock(transport->TcpIn->socketBio, blocking ? FALSE : TRUE)) + return FALSE; } - return status; + return TRUE; } void transport_set_gateway_enabled(rdpTransport* transport, BOOL GatewayEnabled) @@ -884,10 +883,16 @@ BOOL transport_disconnect(rdpTransport* transport) else { if (transport->tls) + { tls_free(transport->tls); + transport->tls = NULL; + } if (transport->TcpIn) + { freerdp_tcp_free(transport->TcpIn); + transport->TcpIn = NULL; + } } transport->TcpIn = NULL;