summaryrefslogtreecommitdiff
path: root/src/socket.cpp
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-08-07 21:25:48 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-08-07 21:25:48 +0000
commit358f2064c432e1e3ef153adeb5aed0fa2e35efde (patch)
tree721353c3c77d93f15bbd9d6fd80df2761b4b6117 /src/socket.cpp
parent923586e54c005780edcc5c427bb4698caf16bcf0 (diff)
Bail if we couldn't bind any ports (when did this get broken?)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@4774 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/socket.cpp')
-rw-r--r--src/socket.cpp39
1 files changed, 21 insertions, 18 deletions
diff --git a/src/socket.cpp b/src/socket.cpp
index 1821120f4..cbb2a213c 100644
--- a/src/socket.cpp
+++ b/src/socket.cpp
@@ -347,19 +347,21 @@ int BindPorts(bool bail)
if ((Config->openSockfd[count] = OpenTCPSocket()) == ERROR)
{
log(DEBUG,"Bad fd %d binding port [%s:%d]",Config->openSockfd[count],Config->addrs[count],Config->ports[count]);
- return ERROR;
- }
- if (!BindSocket(Config->openSockfd[count],client,server,Config->ports[count],Config->addrs[count]))
- {
- log(DEFAULT,"Failed to bind port [%s:%d]: %s",Config->addrs[count],Config->ports[count],strerror(errno));
}
else
{
- /* Associate the new open port with a slot in the socket engine */
- if (Config->openSockfd[count] > -1)
+ if (!BindSocket(Config->openSockfd[count],client,server,Config->ports[count],Config->addrs[count]))
+ {
+ log(DEFAULT,"Failed to bind port [%s:%d]: %s",Config->addrs[count],Config->ports[count],strerror(errno));
+ }
+ else
{
- ServerInstance->SE->AddFd(Config->openSockfd[count],true,X_LISTEN);
- BoundPortCount++;
+ /* Associate the new open port with a slot in the socket engine */
+ if (Config->openSockfd[count] > -1)
+ {
+ ServerInstance->SE->AddFd(Config->openSockfd[count],true,X_LISTEN);
+ BoundPortCount++;
+ }
}
}
}
@@ -403,17 +405,18 @@ int BindPorts(bool bail)
if ((Config->openSockfd[BoundPortCount] = OpenTCPSocket()) == ERROR)
{
log(DEBUG,"Bad fd %d binding port [%s:%d]",Config->openSockfd[BoundPortCount],Config->addrs[count],Config->ports[count]);
- return ERROR;
- }
-
- if (!BindSocket(Config->openSockfd[BoundPortCount],client,server,Config->ports[count],Config->addrs[count]))
- {
- log(DEFAULT,"Failed to bind port [%s:%d]: %s",Config->addrs[count],Config->ports[count],strerror(errno));
}
else
{
- /* well we at least bound to one socket so we'll continue */
- BoundPortCount++;
+ if (!BindSocket(Config->openSockfd[BoundPortCount],client,server,Config->ports[count],Config->addrs[count]))
+ {
+ log(DEFAULT,"Failed to bind port [%s:%d]: %s",Config->addrs[count],Config->ports[count],strerror(errno));
+ }
+ else
+ {
+ /* well we at least bound to one socket so we'll continue */
+ BoundPortCount++;
+ }
}
}
@@ -422,7 +425,7 @@ int BindPorts(bool bail)
{
log(DEFAULT,"No ports bound, bailing!");
printf("\nERROR: Could not bind any of %d ports! Please check your configuration.\n\n", PortCount);
- return ERROR;
+ return 0;
}
return BoundPortCount;