Various small fixes.

This commit is contained in:
Guus Sliepen 2001-03-01 21:32:04 +00:00
parent 099cc867c1
commit 125c497881
4 changed files with 24 additions and 18 deletions

View file

@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: net.c,v 1.35.4.100 2001/02/27 16:37:25 guus Exp $ $Id: net.c,v 1.35.4.101 2001/03/01 21:32:01 guus Exp $
*/ */
#include "config.h" #include "config.h"
@ -84,6 +84,7 @@
#include "process.h" #include "process.h"
#include "protocol.h" #include "protocol.h"
#include "subnet.h" #include "subnet.h"
#include "process.h"
#include "system.h" #include "system.h"
@ -929,11 +930,17 @@ cp
cfg = get_config_val(upstreamcfg, config_connectto); /* Or else we try the next ConnectTo line */ cfg = get_config_val(upstreamcfg, config_connectto); /* Or else we try the next ConnectTo line */
} }
signal(SIGALRM, sigalrm_handler); if(do_detach)
upstreamcfg = config; {
seconds_till_retry = MAXTIMEOUT; signal(SIGALRM, sigalrm_handler);
syslog(LOG_NOTICE, _("Trying to re-establish outgoing connection in %d seconds"), seconds_till_retry); upstreamcfg = config;
alarm(seconds_till_retry); seconds_till_retry = MAXTIMEOUT;
syslog(LOG_NOTICE, _("Trying to re-establish outgoing connection in %d seconds"), seconds_till_retry);
alarm(seconds_till_retry);
}
else
return -1;
cp cp
return 0; return 0;
} }
@ -949,6 +956,7 @@ cp
for(node = connection_tree->head; node; node = node->next) for(node = connection_tree->head; node; node = node->next)
{ {
p = (connection_t *)node->data; p = (connection_t *)node->data;
p->status.outgoing = 0;
p->status.active = 0; p->status.active = 0;
terminate_connection(p); terminate_connection(p);
} }
@ -1349,7 +1357,7 @@ cp
if(read_server_config()) if(read_server_config())
{ {
syslog(LOG_ERR, _("Unable to reread configuration file, exiting")); syslog(LOG_ERR, _("Unable to reread configuration file, exiting"));
exit(0); exit(1);
} }
sleep(5); sleep(5);

View file

@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: process.c,v 1.1.2.20 2001/01/07 17:09:02 guus Exp $ $Id: process.c,v 1.1.2.21 2001/03/01 21:32:04 guus Exp $
*/ */
#include "config.h" #include "config.h"
@ -221,7 +221,7 @@ cp
/* No return on success */ /* No return on success */
if(errno != ENOENT) /* Ignore if the file does not exist */ if(errno != ENOENT) /* Ignore if the file does not exist */
exit(-1); /* Some error while trying execl(). */ exit(1); /* Some error while trying execl(). */
else else
exit(0); exit(0);
} }
@ -309,7 +309,7 @@ sigsegv_square(int a, siginfo_t *info, void *b)
{ {
syslog(LOG_ERR, _("Got another SEGV signal: not restarting")); syslog(LOG_ERR, _("Got another SEGV signal: not restarting"));
cp_trace(); cp_trace();
exit(0); exit(1);
} }
RETSIGTYPE RETSIGTYPE

View file

@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: process.h,v 1.1.2.7 2001/01/07 17:09:02 guus Exp $ $Id: process.h,v 1.1.2.8 2001/03/01 21:32:04 guus Exp $
*/ */
#ifndef __TINC_PROCESS_H__ #ifndef __TINC_PROCESS_H__
@ -25,6 +25,8 @@
#include "config.h" #include "config.h"
extern int do_detach;
extern void setup_signals(void); extern void setup_signals(void);
extern int execute_script(const char *); extern int execute_script(const char *);
extern int detach(void); extern int detach(void);

View file

@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: tincd.c,v 1.10.4.44 2001/02/27 16:37:31 guus Exp $ $Id: tincd.c,v 1.10.4.45 2001/03/01 21:32:04 guus Exp $
*/ */
#include "config.h" #include "config.h"
@ -88,9 +88,6 @@ static int show_version;
/* If nonzero, it will attempt to kill a running tincd and exit. */ /* If nonzero, it will attempt to kill a running tincd and exit. */
static int kill_tincd = 0; static int kill_tincd = 0;
/* If zero, don't detach from the terminal. */
extern int do_detach;
/* If nonzero, generate public/private keypair for this host/net. */ /* If nonzero, generate public/private keypair for this host/net. */
static int generate_keys = 0; static int generate_keys = 0;
@ -356,7 +353,7 @@ cp
exit(kill_other()); exit(kill_other());
if(read_server_config()) if(read_server_config())
return 1; exit(1);
cp cp
if(detach()) if(detach())
exit(0); exit(0);
@ -383,8 +380,7 @@ cp
else else
{ {
syslog(LOG_ERR, _("Not restarting.")); syslog(LOG_ERR, _("Not restarting."));
exit(0); exit(1);
} }
} }
} }