#include <sys/ioctl.h>
#include <time.h>
#include <string>
+#include <exception>
+#include <stdexcept>
+#include <new>
#ifdef GCC3
#include <ext/hash_map>
#else
extern int MODCOUNT;
extern char LOG_FILE[MAXBUF];
-int openSockfd[MAXSOCKS];
+int openSockfd[MAX_DESCRIPTORS];
int yield_depth;
int iterations = 0;
sockaddr_in client,server;
this->MakeLowerMap();
OpenLog(argv, argc);
+ this->stats = new serverstats();
Config->ClearStack();
Config->Read(true,NULL);
CheckRoot();
this->ModeGrok = new ModeParser();
this->Parser = new CommandParser();
- this->stats = new serverstats();
AddServerName(Config->ServerName);
CheckDie();
- stats->BoundPortCount = BindPorts();
+ stats->BoundPortCount = BindPorts(true);
for(int t = 0; t < 255; t++)
Config->global_implementation[t] = 0;
SetSignals();
if (!Config->nofork)
{
- if (DaemonSeed() == ERROR)
+ if (!DaemonSeed())
{
printf("ERROR: could not go into daemon mode. Shutting down.\n");
Exit(ERROR);
int main(int argc, char** argv)
{
- ServerInstance = new InspIRCd(argc, argv);
- ServerInstance->Run();
- delete ServerInstance;
- return 0;
+ try
+ {
+ ServerInstance = new InspIRCd(argc, argv);
+ ServerInstance->Run();
+ delete ServerInstance;
+ }
+ catch (std::bad_alloc)
+ {
+ log(DEFAULT,"You are out of memory! (got exception std::bad_alloc!)");
+ send_error("**** OUT OF MEMORY **** We're gonna need a bigger boat!");
+ printf("Out of memory! (got exception std::bad_alloc!");
+ }
+ return 0;
}