summaryrefslogtreecommitdiff
path: root/src/connection.cpp
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2004-04-16 14:49:10 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2004-04-16 14:49:10 +0000
commit8f9a385d0c512daa0dee38cb37c4d45c9f195e23 (patch)
tree6661bb2d74a17ecddbca16b745c53b86130946ae /src/connection.cpp
parent4b62dbed78d9dca711b2eaffb239232fbe8d0709 (diff)
Mesh cookie linking fixes (was giving remote port to servers and not local port)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@618 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/connection.cpp')
-rw-r--r--src/connection.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/connection.cpp b/src/connection.cpp
index 9344b1621..20695e873 100644
--- a/src/connection.cpp
+++ b/src/connection.cpp
@@ -42,6 +42,8 @@ bool connection::CreateListener(char* host, int p)
int on = 0;
struct linger linger = { 0 };
+ this->port = p;
+
fd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (fd <= 0)
{
@@ -120,6 +122,12 @@ bool ircd_connector::SetHostAddress(char* host, int port)
return true;
}
+void ircd_connector::SetServerPort(int p)
+{
+ this->port = p;
+}
+
+
bool ircd_connector::MakeOutboundConnection(char* host, int port)
{
hostent* hoste = gethostbyname(host);
@@ -161,7 +169,7 @@ bool ircd_connector::MakeOutboundConnection(char* host, int port)
}
-bool connection::BeginLink(char* targethost, int port, char* password, char* servername)
+bool connection::BeginLink(char* targethost, int port, char* password, char* servername, int myport)
{
char connect[MAXBUF];
@@ -174,7 +182,7 @@ bool connection::BeginLink(char* targethost, int port, char* password, char* ser
// targethost has been turned into an ip...
// we dont want this as the server name.
connector.SetServerName(servername);
- sprintf(connect,"S %s %s :%s",getservername().c_str(),password,getserverdesc().c_str());
+ sprintf(connect,"S %s %s %d :%s",getservername().c_str(),password,myport,getserverdesc().c_str());
connector.SetState(STATE_NOAUTH_OUTBOUND);
connector.SetHostAndPort(targethost, port);
this->connectors.push_back(connector);