Explorar o código

Do not remove a not working SrvRecords server twice

The PopFromSrvRecs() already removed the entry from the active
list, so the extra SrvRecords.erase() was incorrect.

Git-Dch: ignore
Michael Vogt %!s(int64=10) %!d(string=hai) anos
pai
achega
0b7d34ee9d
Modificáronse 1 ficheiros con 1 adicións e 3 borrados
  1. 1 3
      methods/connect.cc

+ 1 - 3
methods/connect.cc

@@ -288,12 +288,10 @@ bool Connect(std::string Host,int Port,const char *Service,
    // try to connect in the priority order of the srv records
    // try to connect in the priority order of the srv records
    while(SrvRecords.size() > 0)
    while(SrvRecords.size() > 0)
    {
    {
+      // PopFromSrvRecs will also remove the server
       Host = PopFromSrvRecs(SrvRecords).target;
       Host = PopFromSrvRecs(SrvRecords).target;
       if(ConnectToHostname(Host, Port, Service, DefPort, Fd, TimeOut, Owner))
       if(ConnectToHostname(Host, Port, Service, DefPort, Fd, TimeOut, Owner))
          return true;
          return true;
-
-      // we couldn't connect to this one, use the next
-      SrvRecords.erase(SrvRecords.begin());
    }
    }
 
 
    return false;
    return false;