summaryrefslogtreecommitdiff
path: root/src/tcpproxy.c
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2010-12-10 00:41:52 +0000
committerChristian Pointner <equinox@spreadspace.org>2010-12-10 00:41:52 +0000
commitfcf009ded7a77959da5592e298de93fb044a6757 (patch)
tree3cbd3d7e245e7d63e9c5eed0e5075fa97ea1a6de /src/tcpproxy.c
parentlistner_ vs listeners_ (diff)
re-reading the config file after sig-hup
git-svn-id: https://svn.spreadspace.org/tcpproxy/trunk@43 e61f0598-a718-4e21-a8f0-0aadfa62ad6b
Diffstat (limited to 'src/tcpproxy.c')
-rw-r--r--src/tcpproxy.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/tcpproxy.c b/src/tcpproxy.c
index fcc871f..1007b80 100644
--- a/src/tcpproxy.c
+++ b/src/tcpproxy.c
@@ -71,9 +71,16 @@ int main_loop(options_t* opt, listeners_t* listeners)
continue;
if(FD_ISSET(sig_fd, &readfds)) {
- if(signal_handle()) {
- return_value = 1;
- break;
+ return_value = signal_handle();
+ if(return_value == 1) break;
+ if(return_value == 2) {
+ if(opt->config_file_) {
+ log_printf(NOTICE, "re-reading config file: %s", opt->config_file_);
+ read_configfile(opt->config_file_, listeners);
+ } else
+ log_printf(NOTICE, "ignoring SIGHUP: no config file specified");
+
+ return_value = 0;
}
}
@@ -149,6 +156,7 @@ int main(int argc, char* argv[])
if(opt.local_port_) {
ret = listeners_add(&listeners, opt.local_addr_, opt.lresolv_type_, opt.local_port_, opt.remote_addr_, opt.rresolv_type_, opt.remote_port_, opt.source_addr_);
+ if(!ret) ret = listeners_update(&listeners);
if(ret) {
listeners_clear(&listeners);
options_clear(&opt);
@@ -167,14 +175,6 @@ int main(int argc, char* argv[])
}
}
- ret = listeners_activate(&listeners);
- if(ret) {
- listeners_clear(&listeners);
- options_clear(&opt);
- log_close();
- exit(-1);
- }
-
priv_info_t priv;
if(opt.username_)
if(priv_init(&priv, opt.username_, opt.groupname_)) {