From d1f2d6c1185170a1f038dfc1f535a267f76a5d4c Mon Sep 17 00:00:00 2001 From: Meep-Eep Date: Sun, 14 Jan 2007 14:11:14 +0000 Subject: [PATCH] A bit more debug info for failed connects. git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@2667 8092fc87-c524-0410-9efc-e669fe64eaf9 --- sc2/ChangeLog | 1 + sc2/src/sc2code/libs/network/connect/connect.c | 13 ++++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/sc2/ChangeLog b/sc2/ChangeLog index eb8c15785..9194e8181 100644 --- a/sc2/ChangeLog +++ b/sc2/ChangeLog @@ -1,4 +1,5 @@ Changes towards version 0.7: +- A bit more debug info for failed connects. - SvdB - Exit with failure if basic content cannot be found, ensuring proper error reporting under Windows - Michael - Popup windows for "Really Exit?" and Game Pause are immune to fades diff --git a/sc2/src/sc2code/libs/network/connect/connect.c b/sc2/src/sc2code/libs/network/connect/connect.c index 76bb0e8fd..8d3dbad87 100644 --- a/sc2/src/sc2code/libs/network/connect/connect.c +++ b/sc2/src/sc2code/libs/network/connect/connect.c @@ -146,6 +146,9 @@ connectCallback(NetDescriptor *nd) { if (connectState->state == Connect_closed) { // The connection attempt has been aborted. +#ifdef DEBUG + log_add(log_Debug, "Connection attempt was aborted.\n"); +#endif ConnectState_decRef(connectState); return; } @@ -256,10 +259,18 @@ tryConnectHostNext(ConnectState *connectState) { return sock; } - // Connection failed. + // Connection failed immediately. This is just for one of the addresses, + // so this does not have to be final. + // Note that as the socket is non-blocking, most failed connection + // errors will usually not be reported immediately. { int savedErrno = errno; Socket_close(sock); +#ifdef DEBUG + log_add(log_Debug, "connect() immediately failed for one address: " + "%s.\n", strerror(errno)); + // TODO: add the address in the status message. +#endif errno = savedErrno; } return Socket_noSocket;