* | Inspire Internet Relay Chat Daemon |
* +------------------------------------+
*
- * Inspire is copyright (C) 2002-2005 ChatSpike-Dev.
+ * InspIRCd is copyright (C) 2002-2006 ChatSpike-Dev.
* E-mail:
* <brain@chatspike.net>
* <Craig@chatspike.net>
// This table references users by file descriptor.
// its an array to make it VERY fast, as all lookups are referenced
// by an integer, meaning there is no need for a scan/search operation.
-userrec* fd_ref_table[65536];
+userrec* fd_ref_table[MAX_DESCRIPTORS];
Server* MyServer = new Server;
ServerConfig *Config = new ServerConfig;
#else
char dnsengine[] = "singlethread";
#endif
- snprintf(versiondata,MAXBUF,"%s Rev. %s %s :%s [FLAGS=%lu,%s,%s]",VERSION,GetRevision().c_str(),Config->ServerName,SYSTEM,(unsigned long)OPTIMISATION,SE->GetName().c_str(),dnsengine);
+ if (*Config->CustomVersion)
+ {
+ snprintf(versiondata,MAXBUF,"%s Rev. %s %s :%s",VERSION,GetRevision().c_str(),Config->ServerName,Config->CustomVersion);
+ }
+ else
+ {
+ snprintf(versiondata,MAXBUF,"%s Rev. %s %s :%s [FLAGS=%lu,%s,%s]",VERSION,GetRevision().c_str(),Config->ServerName,SYSTEM,(unsigned long)OPTIMISATION,SE->GetName().c_str(),dnsengine);
+ }
return versiondata;
}
break;
}
}
- if (v2 == slot)
+ if (v2 == (unsigned int)slot)
{
log(DEBUG,"Item %s already in slot %d!",modulename.c_str(),slot);
}
{
// the neatest way to construct the initial 005 numeric, considering the number of configure constants to go in it...
std::stringstream v;
- v << "WALLCHOPS MODES=13 CHANTYPES=# PREFIX=(ohv)@%+ MAP SAFELIST MAXCHANNELS=" << MAXCHANS << " MAXBANS=60 NICKLEN=" << NICKMAX;
+ v << "WALLCHOPS MODES=13 CHANTYPES=# PREFIX=(ohv)@%+ MAP SAFELIST MAXCHANNELS=" << MAXCHANS << " MAXBANS=60 NICKLEN=" << NICKMAX-1;
v << " CASEMAPPING=rfc1459 STATUSMSG=@+ CHARSET=ascii TOPICLEN=" << MAXTOPIC << " KICKLEN=" << MAXKICK << " MAXTARGETS=20 AWAYLEN=";
v << MAXAWAY << " CHANMODES=ohvb,k,l,psmnti NETWORK=" << Config->Network;
Config->data005 = v.str();
uslen = sizeof(sock_us);
length = sizeof(client);
incomingSockfd = accept (activefds[activefd],(struct sockaddr*)&client,&length);
- if (!getsockname(incomingSockfd,(sockaddr*)&sock_us,&uslen))
+
+ if ((incomingSockfd > -1) && (!getsockname(incomingSockfd,(sockaddr*)&sock_us,&uslen)))
{
in_port = ntohs(sock_us.sin_port);
log(DEBUG,"Accepted socket %d",incomingSockfd);
* using gethostbyaddr(). That is sucky and we
* don't do that any more...
*/
- if (incomingSockfd >= 0)
- {
- NonBlocking(incomingSockfd);
- if (Config->GetIOHook(in_port))
- {
- Config->GetIOHook(in_port)->OnRawSocketAccept(incomingSockfd, target, in_port);
- }
- stats->statsAccept++;
- AddClient(incomingSockfd, target, in_port, false, target);
- log(DEBUG,"Adding client on port %lu fd=%lu",(unsigned long)in_port,(unsigned long)incomingSockfd);
- }
- else
+ NonBlocking(incomingSockfd);
+ if (Config->GetIOHook(in_port))
{
- WriteOpers("*** WARNING: accept() failed on port %lu (%s)",(unsigned long)in_port,target);
- log(DEBUG,"accept failed: %lu",(unsigned long)in_port);
- stats->statsRefused++;
+ Config->GetIOHook(in_port)->OnRawSocketAccept(incomingSockfd, target, in_port);
}
+ stats->statsAccept++;
+ AddClient(incomingSockfd, target, in_port, false, target);
+ log(DEBUG,"Adding client on port %lu fd=%lu",(unsigned long)in_port,(unsigned long)incomingSockfd);
}
else
{
- log(DEBUG,"Couldnt look up the port number for fd %lu (OS BROKEN?!)",incomingSockfd);
+ log(DEBUG,"Accept failed on fd %lu: %s",(unsigned long)incomingSockfd,strerror(errno));
shutdown(incomingSockfd,2);
close(incomingSockfd);
+ stats->statsRefused++;
}
break;