Commit c1afe88fd4c50f69d5601879ad4252e3233eeb09

Authored by Georg Hopp
1 parent e73c8d95

log when connect fails

Showing 2 changed files with 8 additions and 1 deletions
@@ -4,3 +4,5 @@ VERY BIG TODO: @@ -4,3 +4,5 @@ VERY BIG TODO:
4 right now ws specification is not final anyway. :) 4 right now ws specification is not final anyway. :)
5 5
6 - handle errors after all system call...especially open, close, etc. 6 - handle errors after all system call...especially open, close, etc.
  7 +
  8 +- IPV6 support
@@ -29,7 +29,7 @@ @@ -29,7 +29,7 @@
29 29
30 30
31 void 31 void
32 -socketConnect(Sock this, const char * addr) 32 +socketConnect(Sock this, const char * addr, char (*remoteAddr)[16])
33 { 33 {
34 inet_pton(AF_INET, addr, &((this->addr).sin_addr)); 34 inet_pton(AF_INET, addr, &((this->addr).sin_addr));
35 (this->addr).sin_family = AF_INET; // Internet address family 35 (this->addr).sin_family = AF_INET; // Internet address family
@@ -44,6 +44,11 @@ socketConnect(Sock this, const char * addr) @@ -44,6 +44,11 @@ socketConnect(Sock this, const char * addr)
44 "error connection socket: %s - service terminated", 44 "error connection socket: %s - service terminated",
45 strerror(errno)); 45 strerror(errno));
46 exit(EXIT_FAILURE); 46 exit(EXIT_FAILURE);
  47 + } else {
  48 + strcpy(*remoteAddr, inet_ntoa((sock->addr).sin_addr));
  49 +
  50 + loggerLog(this->log, LOGGER_INFO,
  51 + "handling connection %s\n", inet_ntoa((sock->addr).sin_addr));
47 } 52 }
48 } 53 }
49 54
Please register or login to post a comment