Hi,

attached is a patch that should fix the problem.

Cheers,
 Michael
Index: apt-transport-debtorrent-0.1.1ubuntu1/connect.cc
===================================================================
--- apt-transport-debtorrent-0.1.1ubuntu1.orig/connect.cc	2007-11-13 15:53:38.000000000 +0100
+++ apt-transport-debtorrent-0.1.1ubuntu1/connect.cc	2007-11-13 16:11:45.000000000 +0100
@@ -18,6 +18,7 @@
 #include <stdio.h>
 #include <errno.h>
 #include <unistd.h>
+#include <sstream>
 
 // Internet stuff
 #include <netinet/in.h>
@@ -66,12 +67,10 @@
       wrong this will get tacked onto the end of the error message */
    if (LastHostAddr->ai_next != 0)
    {
-      char Name2[NI_MAXHOST + NI_MAXSERV + 10];
-      snprintf(Name2,sizeof(Name2),"[IP: %s %s]",Name,Service);
-      Owner->SetFailExtraMsg(string(Name2));
-   }   
-   else
-      Owner->SetFailExtraMsg("");
+      std::stringstream ss;
+      ioprintf(ss, "[IP: %s %s]",Name,Service);
+      Owner->SetIP(ss.str());
+   }
       
    // Get a socket
    if ((Fd = socket(Addr->ai_family,Addr->ai_socktype,
@@ -88,7 +87,7 @@
    /* This implements a timeout for connect by opening the connection
       nonblocking */
    if (WaitFd(Fd,true,TimeOut) == false) {
-      Owner->SetFailExtraMsg("\nFailReason: Timeout");
+      Owner->SetFailReason("Timeout");
       return _error->Error("Could not connect to %s:%s (%s), "
 			   "connection timed out",Host.c_str(),Service,Name);
    }
@@ -103,7 +102,7 @@
    {
       errno = Err;
       if(errno == ECONNREFUSED)
-         Owner->SetFailExtraMsg("\nFailReason: ConnectionRefused");
+         Owner->SetFailReason("ConnectionRefused");
       return _error->Errno("connect","Could not connect to %s:%s (%s).",Host.c_str(),
 			   Service,Name);
    }
@@ -168,7 +167,7 @@
 	    
 	    if (Res == EAI_AGAIN)
 	    {
-	       Owner->SetFailExtraMsg("\nFailReason: TmpResolveFailure");
+	       Owner->SetFailReason("TmpResolveFailure");
 	       return _error->Error("Temporary failure resolving '%s'",
 				    Host.c_str());
 	    }

Reply via email to