mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-07 05:24:46 +01:00
Merge branch 'android_branch' into gtk_multigame
This commit is contained in:
commit
aed2b6135c
1 changed files with 12 additions and 2 deletions
|
@ -77,6 +77,7 @@
|
||||||
#include "dbmgr.h"
|
#include "dbmgr.h"
|
||||||
|
|
||||||
static int s_nSpawns = 0;
|
static int s_nSpawns = 0;
|
||||||
|
static int g_maxsocks = -1;
|
||||||
|
|
||||||
void
|
void
|
||||||
logf( XW_LogLevel level, const char* format, ... )
|
logf( XW_LogLevel level, const char* format, ... )
|
||||||
|
@ -667,6 +668,7 @@ usage( char* arg0 )
|
||||||
"\t-h (print this help)\\\n"
|
"\t-h (print this help)\\\n"
|
||||||
"\t-i <idfile> (file where next global id stored)\\\n"
|
"\t-i <idfile> (file where next global id stored)\\\n"
|
||||||
"\t-l <logfile> (write logs here, not stderr)\\\n"
|
"\t-l <logfile> (write logs here, not stderr)\\\n"
|
||||||
|
"\t-m <num_sockets> (max number of simultaneous sockets to have open)\\\n"
|
||||||
"\t-n <serverName> (used in permID generation)\\\n"
|
"\t-n <serverName> (used in permID generation)\\\n"
|
||||||
"\t-p <port> (port to listen on)\\\n"
|
"\t-p <port> (port to listen on)\\\n"
|
||||||
#ifdef DO_HTTP
|
#ifdef DO_HTTP
|
||||||
|
@ -1146,7 +1148,7 @@ main( int argc, char** argv )
|
||||||
first. */
|
first. */
|
||||||
|
|
||||||
for ( ; ; ) {
|
for ( ; ; ) {
|
||||||
int opt = getopt(argc, argv, "h?c:p:n:f:l:t:s:w:"
|
int opt = getopt(argc, argv, "h?c:p:m:n:f:l:t:s:w:"
|
||||||
"DF" );
|
"DF" );
|
||||||
|
|
||||||
if ( opt == -1 ) {
|
if ( opt == -1 ) {
|
||||||
|
@ -1188,6 +1190,9 @@ main( int argc, char** argv )
|
||||||
case 'l':
|
case 'l':
|
||||||
logFile = optarg;
|
logFile = optarg;
|
||||||
break;
|
break;
|
||||||
|
case 'm':
|
||||||
|
g_maxsocks = atoi( optarg );
|
||||||
|
break;
|
||||||
case 'n':
|
case 'n':
|
||||||
serverName = optarg;
|
serverName = optarg;
|
||||||
break;
|
break;
|
||||||
|
@ -1227,6 +1232,11 @@ main( int argc, char** argv )
|
||||||
if ( nWorkerThreads == 0 ) {
|
if ( nWorkerThreads == 0 ) {
|
||||||
(void)cfg->GetValueFor( "NTHREADS", &nWorkerThreads );
|
(void)cfg->GetValueFor( "NTHREADS", &nWorkerThreads );
|
||||||
}
|
}
|
||||||
|
if ( g_maxsocks == -1 ) {
|
||||||
|
(void)cfg->GetValueFor( "MAXSOCKS", &g_maxsocks );
|
||||||
|
} else {
|
||||||
|
g_maxsocks = 100;
|
||||||
|
}
|
||||||
char serverNameBuf[128];
|
char serverNameBuf[128];
|
||||||
if ( serverName == NULL ) {
|
if ( serverName == NULL ) {
|
||||||
if ( cfg->GetValueFor( "SERVERNAME", serverNameBuf,
|
if ( cfg->GetValueFor( "SERVERNAME", serverNameBuf,
|
||||||
|
@ -1430,7 +1440,7 @@ main( int argc, char** argv )
|
||||||
// connections. Sockets are not closed, and so the
|
// connections. Sockets are not closed, and so the
|
||||||
// number goes up. Probably need a watchdog instead,
|
// number goes up. Probably need a watchdog instead,
|
||||||
// but this will work around it.
|
// but this will work around it.
|
||||||
assert( 100 > newSock );
|
assert( g_maxsocks > newSock );
|
||||||
|
|
||||||
/* Set timeout so send and recv won't block forever */
|
/* Set timeout so send and recv won't block forever */
|
||||||
set_timeouts( newSock );
|
set_timeouts( newSock );
|
||||||
|
|
Loading…
Reference in a new issue