when you are redirected to a different hub on the same address, dc++ only checks if it is the same address and does not check the port.
then it realises (falsly) that it's already connected, then disconnects and says "Redirect recieved to a hub that's already connected." (and reconnects after two minutes)
fix below:
client/Client.h
Code: Select all
--- client/orig/Client.h 2002-12-28 02:31:50.000000000 +0100
+++ client/Client.h 2003-01-29 13:24:58.000000000 +0100
@@ -166,6 +166,7 @@
}
const string& getIp() { return ((socket == NULL) || socket->getIp().empty()) ? server : socket->getIp(); };
+ const short getPort() { return port; }
GETSETREF(string, nick, Nick);
GETSET(bool, userInfo, UserInfo);
Code: Select all
--- client/orig/ClientManager.h 2002-12-28 02:31:50.000000000 +0100
+++ client/ClientManager.h 2003-01-29 13:31:54.000000000 +0100
@@ -54,11 +54,11 @@
return c;
}
- bool isConnected(const string& aServer) {
+ bool isConnected(const string& aServer, short port /* = 411 */ ) {
Lock l(cs);
for(Client::Iter i = clients.begin(); i != clients.end(); ++i) {
- if((*i)->getServer() == aServer || (*i)->getIp() == aServer) {
+ if(((*i)->getServer() == aServer || (*i)->getIp() == aServer) && (*i)->getPort() == port) {
return true;
}
}
Code: Select all
--- windows/orig/HubFrame.cpp 2003-01-05 13:09:36.000000000 +0100
+++ windows/HubFrame.cpp 2003-01-29 13:28:42.000000000 +0100
@@ -938,7 +938,7 @@
string s, f;
short p = 411;
Util::decodeUrl(redirect, s, p, f);
- if(ClientManager::getInstance()->isConnected(s)) {
+ if(ClientManager::getInstance()->isConnected(s, p)) {
addClientLine(STRING(REDIRECT_ALREADY_CONNECTED));
return 0;
}
@@ -1014,7 +1014,7 @@
string s, f;
short p = 411;
Util::decodeUrl(line, s, p, f);
- if(ClientManager::getInstance()->isConnected(s)) {
+ if(ClientManager::getInstance()->isConnected(s, p)) {
speak(ADD_STATUS_LINE, STRING(REDIRECT_ALREADY_CONNECTED));
return;
}