summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/inspircd.cpp2
-rw-r--r--src/socket.cpp17
2 files changed, 10 insertions, 9 deletions
diff --git a/src/inspircd.cpp b/src/inspircd.cpp
index c022b0bb9..18d289381 100644
--- a/src/inspircd.cpp
+++ b/src/inspircd.cpp
@@ -301,7 +301,7 @@ InspIRCd::InspIRCd(int argc, char** argv)
this->Log(DEBUG,"%d listeners",stats->BoundPortCount);
for (unsigned long count = 0; count < stats->BoundPortCount; count++)
{
- this->Log(DEBUG,"Add listener: %d",Config->openSockfd[count]);
+ this->Log(DEBUG,"Add listener: %d",Config->openSockfd[count]->GetFd());
if (!SE->AddFd(Config->openSockfd[count]))
{
printf("\nEH? Could not add listener to socketengine. You screwed up, aborting.\n");
diff --git a/src/socket.cpp b/src/socket.cpp
index 50a4050e0..2dc8f017d 100644
--- a/src/socket.cpp
+++ b/src/socket.cpp
@@ -422,6 +422,7 @@ int InspIRCd::BindPorts(bool bail)
int PortCount = clientportcount;
if (PortCount)
{
+ BoundPortCount = stats->BoundPortCount;
for (int count = InitialPortCount; count < InitialPortCount + PortCount; count++)
{
int fd = OpenTCPSocket();
@@ -431,15 +432,15 @@ int InspIRCd::BindPorts(bool bail)
}
else
{
- Config->openSockfd[count] = new ListenSocket(this,fd,client,server,Config->ports[count],Config->addrs[count]);
- if (Config->openSockfd[count]->GetFd() > -1)
+ Config->openSockfd[BoundPortCount] = new ListenSocket(this,fd,client,server,Config->ports[count],Config->addrs[count]);
+ if (Config->openSockfd[BoundPortCount]->GetFd() > -1)
{
- if (!SE->AddFd(Config->openSockfd[count]))
+ if (!SE->AddFd(Config->openSockfd[BoundPortCount]))
{
this->Log(DEFAULT,"ERK! Failed to add listening port to socket engine!");
- shutdown(Config->openSockfd[count]->GetFd(),2);
- close(Config->openSockfd[count]->GetFd());
- delete Config->openSockfd[count];
+ shutdown(Config->openSockfd[BoundPortCount]->GetFd(),2);
+ close(Config->openSockfd[BoundPortCount]->GetFd());
+ delete Config->openSockfd[BoundPortCount];
}
else
BoundPortCount++;
@@ -494,8 +495,8 @@ int InspIRCd::BindPorts(bool bail)
}
else
{
- Config->openSockfd[count] = new ListenSocket(this,fd,client,server,Config->ports[count],Config->addrs[count]);
- if (Config->openSockfd[count]->GetFd() > -1)
+ Config->openSockfd[BoundPortCount] = new ListenSocket(this,fd,client,server,Config->ports[count],Config->addrs[count]);
+ if (Config->openSockfd[BoundPortCount]->GetFd() > -1)
{
BoundPortCount++;
}