libfreerdp-core: properly attach tcp event handle for peers
This commit is contained in:
parent
69128d8018
commit
1fab70504f
@ -33,6 +33,7 @@ typedef void (*psPeerContextFree)(freerdp_peer* client, rdpContext* context);
|
||||
|
||||
typedef BOOL (*psPeerInitialize)(freerdp_peer* client);
|
||||
typedef BOOL (*psPeerGetFileDescriptor)(freerdp_peer* client, void** rfds, int* rcount);
|
||||
typedef HANDLE (*psPeerGetEventHandle)(freerdp_peer* client);
|
||||
typedef BOOL (*psPeerCheckFileDescriptor)(freerdp_peer* client);
|
||||
typedef BOOL (*psPeerClose)(freerdp_peer* client);
|
||||
typedef void (*psPeerDisconnect)(freerdp_peer* client);
|
||||
@ -60,6 +61,7 @@ struct rdp_freerdp_peer
|
||||
|
||||
psPeerInitialize Initialize;
|
||||
psPeerGetFileDescriptor GetFileDescriptor;
|
||||
psPeerGetEventHandle GetEventHandle;
|
||||
psPeerCheckFileDescriptor CheckFileDescriptor;
|
||||
psPeerClose Close;
|
||||
psPeerDisconnect Disconnect;
|
||||
|
@ -54,6 +54,11 @@ static BOOL freerdp_peer_get_fds(freerdp_peer* client, void** rfds, int* rcount)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static HANDLE freerdp_peer_get_event_handle(freerdp_peer* client)
|
||||
{
|
||||
return client->context->rdp->transport->TcpIn->event;
|
||||
}
|
||||
|
||||
static BOOL freerdp_peer_check_fds(freerdp_peer* client)
|
||||
{
|
||||
int status;
|
||||
@ -432,12 +437,13 @@ freerdp_peer* freerdp_peer_new(int sockfd)
|
||||
|
||||
freerdp_tcp_set_no_delay(sockfd, TRUE);
|
||||
|
||||
if (client != NULL)
|
||||
if (client)
|
||||
{
|
||||
client->sockfd = sockfd;
|
||||
client->ContextSize = sizeof(rdpContext);
|
||||
client->Initialize = freerdp_peer_initialize;
|
||||
client->GetFileDescriptor = freerdp_peer_get_fds;
|
||||
client->GetEventHandle = freerdp_peer_get_event_handle;
|
||||
client->CheckFileDescriptor = freerdp_peer_check_fds;
|
||||
client->Close = freerdp_peer_close;
|
||||
client->Disconnect = freerdp_peer_disconnect;
|
||||
|
@ -253,6 +253,13 @@ BOOL tcp_set_keep_alive_mode(rdpTcp* tcp)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
int tcp_attach(rdpTcp* tcp, int sockfd)
|
||||
{
|
||||
tcp->sockfd = sockfd;
|
||||
SetEventFileDescriptor(tcp->event, tcp->sockfd);
|
||||
return 0;
|
||||
}
|
||||
|
||||
HANDLE tcp_get_event_handle(rdpTcp* tcp)
|
||||
{
|
||||
#ifndef _WIN32
|
||||
|
@ -56,6 +56,7 @@ int tcp_wait_read(rdpTcp* tcp);
|
||||
int tcp_wait_write(rdpTcp* tcp);
|
||||
BOOL tcp_set_blocking_mode(rdpTcp* tcp, BOOL blocking);
|
||||
BOOL tcp_set_keep_alive_mode(rdpTcp* tcp);
|
||||
int tcp_attach(rdpTcp* tcp, int sockfd);
|
||||
HANDLE tcp_get_event_handle(rdpTcp* tcp);
|
||||
|
||||
rdpTcp* tcp_new(rdpSettings* settings);
|
||||
|
@ -64,8 +64,7 @@ wStream* transport_send_stream_init(rdpTransport* transport, int size)
|
||||
|
||||
void transport_attach(rdpTransport* transport, int sockfd)
|
||||
{
|
||||
transport->TcpIn->sockfd = sockfd;
|
||||
|
||||
tcp_attach(transport->TcpIn, sockfd);
|
||||
transport->SplitInputOutput = FALSE;
|
||||
transport->TcpOut = transport->TcpIn;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user