From ada9936a6635cc64e850d554c1b5a8d765c4ddd4 Mon Sep 17 00:00:00 2001 From: Vic Lee Date: Tue, 22 May 2012 23:10:52 +0800 Subject: [PATCH] libfreerdp-core/server: add local flag for unix connection. --- include/freerdp/peer.h | 1 + libfreerdp-core/listener.c | 4 ++++ server/test/tfreerdp.c | 6 +++--- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/include/freerdp/peer.h b/include/freerdp/peer.h index e0326d566..5031acc4c 100644 --- a/include/freerdp/peer.h +++ b/include/freerdp/peer.h @@ -69,6 +69,7 @@ struct rdp_freerdp_peer psPeerReceiveChannelData ReceiveChannelData; uint32 ack_frame_id; + boolean local; }; FREERDP_API void freerdp_peer_context_new(freerdp_peer* client); diff --git a/libfreerdp-core/listener.c b/libfreerdp-core/listener.c index e3b976568..6c88704dc 100644 --- a/libfreerdp-core/listener.c +++ b/libfreerdp-core/listener.c @@ -237,6 +237,10 @@ static boolean freerdp_listener_check_fds(freerdp_listener* instance) sin_addr = &(((struct sockaddr_in*) &peer_addr)->sin_addr); else if (peer_addr.ss_family == AF_INET6) sin_addr = &(((struct sockaddr_in6*) &peer_addr)->sin6_addr); +#ifndef _WIN32 + else if (peer_addr.ss_family == AF_UNIX) + client->local = true; +#endif if (sin_addr) inet_ntop(peer_addr.ss_family, sin_addr, client->hostname, sizeof(client->hostname)); diff --git a/server/test/tfreerdp.c b/server/test/tfreerdp.c index 09becdc20..b02c1ecaf 100644 --- a/server/test/tfreerdp.c +++ b/server/test/tfreerdp.c @@ -461,7 +461,7 @@ boolean tf_peer_post_connect(freerdp_peer* client) * The server may start sending graphics output and receiving keyboard/mouse input after this * callback returns. */ - printf("Client %s is activated (osMajorType %d osMinorType %d)", client->hostname, + printf("Client %s is activated (osMajorType %d osMinorType %d)", client->local ? "(local)" : client->hostname, client->settings->os_major_type, client->settings->os_minor_type); if (client->settings->autologon) { @@ -613,7 +613,7 @@ static void* test_peer_mainloop(void* arg) client->Initialize(client); context = (testPeerContext*) client->context; - printf("We've got a client %s\n", client->hostname); + printf("We've got a client %s\n", client->local ? "(local)" : client->hostname); while (1) { @@ -661,7 +661,7 @@ static void* test_peer_mainloop(void* arg) break; } - printf("Client %s disconnected.\n", client->hostname); + printf("Client %s disconnected.\n", client->local ? "(local)" : client->hostname); client->Disconnect(client); freerdp_peer_context_free(client);