mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-30 08:34:16 +01:00
Make it possible to launch relay early in machine boot cycle before
postgres is running (e.g. from a @reboot shortcut in a crontab) by having it wait, sleeping periodically, until a connection is available. Requires new flag be passed into main.
This commit is contained in:
parent
d605686fd6
commit
8f863f0369
1 changed files with 10 additions and 1 deletions
|
@ -1172,6 +1172,7 @@ usage( char* arg0 )
|
|||
#ifdef DO_HTTP
|
||||
"\t-w <cport> (localhost port for web interface)\\\n"
|
||||
#endif
|
||||
"\t-b (block until postgres connection available)\\\n"
|
||||
"\t-D (don't become daemon)\\\n"
|
||||
"\t-F (don't fork and wait to respawn child)\\\n"
|
||||
"\t-f <conffile> (config file)\\\n"
|
||||
|
@ -2022,6 +2023,7 @@ main( int argc, char** argv )
|
|||
const char* maint_str = NULL;
|
||||
bool doDaemon = true;
|
||||
bool doFork = true;
|
||||
bool doBlock = false;
|
||||
|
||||
(void)uptime(); /* force capture of start time */
|
||||
|
||||
|
@ -2033,7 +2035,7 @@ main( int argc, char** argv )
|
|||
first. */
|
||||
|
||||
for ( ; ; ) {
|
||||
int opt = getopt(argc, argv, "h?c:p:M:m:n:f:l:t:s:u:w:"
|
||||
int opt = getopt(argc, argv, "bh?c:p:M:m:n:f:l:t:s:u:w:"
|
||||
"DF" );
|
||||
|
||||
if ( opt == -1 ) {
|
||||
|
@ -2044,6 +2046,9 @@ main( int argc, char** argv )
|
|||
case 'h':
|
||||
usage( argv[0] );
|
||||
exit( 0 );
|
||||
case 'b':
|
||||
doBlock = true;
|
||||
break;
|
||||
case 'c':
|
||||
ctrlport = atoi( optarg );
|
||||
break;
|
||||
|
@ -2194,6 +2199,10 @@ main( int argc, char** argv )
|
|||
}
|
||||
#endif
|
||||
|
||||
if ( doBlock ) {
|
||||
DBMgr::Get()->WaitDBConn();
|
||||
}
|
||||
|
||||
if ( -1 != udpport ) {
|
||||
struct sockaddr_in saddr;
|
||||
g_udpsock = socket( AF_INET, SOCK_DGRAM, IPPROTO_UDP );
|
||||
|
|
Loading…
Add table
Reference in a new issue