summaryrefslogtreecommitdiffstats
path: root/common/os_calls.c
diff options
context:
space:
mode:
authorArvidNorr <norrarvid@gmail.com>2013-01-31 11:22:43 -0800
committerArvidNorr <norrarvid@gmail.com>2013-01-31 11:22:43 -0800
commit72c99794ee6d2811ba9c85d76e1f30f2309ac7d8 (patch)
treea76dc3599dea4ecc8d4a7a6369ab3b0873547dc1 /common/os_calls.c
parent9aa0cb4e61eeb253a9a1177f1162eb5289130e96 (diff)
parentfb7294ed26d28b12d8da5cf5f41f5975f1999f04 (diff)
downloadxrdp-proprietary-72c99794ee6d2811ba9c85d76e1f30f2309ac7d8.tar.gz
xrdp-proprietary-72c99794ee6d2811ba9c85d76e1f30f2309ac7d8.zip
Merge pull request #59 from ArvidNorr/morelogging
More logging for debug and trace.
Diffstat (limited to 'common/os_calls.c')
-rw-r--r--common/os_calls.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/common/os_calls.c b/common/os_calls.c
index 07f378e5..500db201 100644
--- a/common/os_calls.c
+++ b/common/os_calls.c
@@ -60,6 +60,7 @@
#include "os_calls.h"
#include "arch.h"
+#include "log.h"
/* for clearenv() */
#if defined(_WIN32)
@@ -493,6 +494,7 @@ g_tcp_local_socket(void)
void APP_CC
g_tcp_close(int sck)
{
+ char ip[256] ;
if (sck == 0)
{
return;
@@ -501,6 +503,8 @@ g_tcp_close(int sck)
#if defined(_WIN32)
closesocket(sck);
#else
+ g_write_ip_address(sck,ip,255);
+ log_message(LOG_LEVEL_INFO,"An established connection closed to endpoint: %s", ip);
close(sck);
#endif
}
@@ -636,6 +640,8 @@ g_tcp_listen(int sck)
int APP_CC
g_tcp_accept(int sck)
{
+ int ret ;
+ char ipAddr[256] ;
struct sockaddr_in s;
#if defined(_WIN32)
signed int i;
@@ -645,7 +651,14 @@ g_tcp_accept(int sck)
i = sizeof(struct sockaddr_in);
memset(&s, 0, i);
- return accept(sck, (struct sockaddr *)&s, &i);
+ ret = accept(sck, (struct sockaddr *)&s, &i);
+ if(ret>0)
+ {
+ snprintf(ipAddr,255,"A connection received from: %s port %d"
+ ,inet_ntoa(s.sin_addr),ntohs(s.sin_port));
+ log_message(LOG_LEVEL_INFO,ipAddr);
+ }
+ return ret ;
}
/*****************************************************************************/