/* 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++;
+ if (!ServerInstance->SE->AddFd(Config->openSockfd[count],true,X_LISTEN))
+ {
+ log(DEFAULT,"ERK! Failed to add listening port to socket engine!");
+ shutdown(Config->openSockfd[count],2);
+ close(Config->openSockfd[count]);
+ }
+ else
+ BoundPortCount++;
}
}
}
}
}
}
-
- /* if we didn't bind to anything then abort */
- if (!BoundPortCount)
- {
- log(DEFAULT,"No ports bound, bailing!");
- printf("\nERROR: Could not bind any of %d ports! Please check your configuration.\n\n", PortCount);
- return 0;
- }
-
return BoundPortCount;
}