Browse Source

log when connect fails

master
Georg Hopp 14 years ago
parent
commit
c1afe88fd4
  1. 2
      TODO
  2. 7
      src/socket/connect.c

2
TODO

@ -4,3 +4,5 @@ VERY BIG TODO:
right now ws specification is not final anyway. :) right now ws specification is not final anyway. :)
- handle errors after all system call...especially open, close, etc. - handle errors after all system call...especially open, close, etc.
- IPV6 support

7
src/socket/connect.c

@ -29,7 +29,7 @@
void void
socketConnect(Sock this, const char * addr)
socketConnect(Sock this, const char * addr, char (*remoteAddr)[16])
{ {
inet_pton(AF_INET, addr, &((this->addr).sin_addr)); inet_pton(AF_INET, addr, &((this->addr).sin_addr));
(this->addr).sin_family = AF_INET; // Internet address family (this->addr).sin_family = AF_INET; // Internet address family
@ -44,6 +44,11 @@ socketConnect(Sock this, const char * addr)
"error connection socket: %s - service terminated", "error connection socket: %s - service terminated",
strerror(errno)); strerror(errno));
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} else {
strcpy(*remoteAddr, inet_ntoa((sock->addr).sin_addr));
loggerLog(this->log, LOGGER_INFO,
"handling connection %s\n", inet_ntoa((sock->addr).sin_addr));
} }
} }

Loading…
Cancel
Save