summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorslioch <slioch@eng-140.vyatta.com>2008-12-04 14:45:06 -0800
committerslioch <slioch@eng-140.vyatta.com>2008-12-04 14:45:06 -0800
commit1c57ff025f86300db03dfa8fe08f7e64bf462629 (patch)
tree92c62f3acd90fce21f563ac84938756ae99638de /src
parent43be74e8740be9ea7d85ac76210884db53bac172 (diff)
downloadvyatta-wanloadbalance-1c57ff025f86300db03dfa8fe08f7e64bf462629.tar.gz
vyatta-wanloadbalance-1c57ff025f86300db03dfa8fe08f7e64bf462629.zip
added sigusr2 to wake up process from sleep call. will be used to wake up process when address changes via dhcp.
Diffstat (limited to 'src')
-rw-r--r--src/loadbalance.cc11
-rw-r--r--src/loadbalance.hh3
-rw-r--r--src/main.cc12
3 files changed, 22 insertions, 4 deletions
diff --git a/src/loadbalance.cc b/src/loadbalance.cc
index 57d602d..40c2840 100644
--- a/src/loadbalance.cc
+++ b/src/loadbalance.cc
@@ -93,3 +93,14 @@ LoadBalance::output()
_output.write(_lbdata);
}
+
+/**
+ *
+ **/
+//temporary stand-in for now...
+void
+LoadBalance::sleep()
+{
+ ::sleep(5);
+}
+
diff --git a/src/loadbalance.hh b/src/loadbalance.hh
index 8f57b92..e4ac80a 100644
--- a/src/loadbalance.hh
+++ b/src/loadbalance.hh
@@ -40,8 +40,7 @@ class LoadBalance
void output();
- //temporary stand-in for now...
- void sleep() {::sleep(5);}
+ void sleep();
private:
bool _debug;
diff --git a/src/main.cc b/src/main.cc
index c8393e8..1d3a35d 100644
--- a/src/main.cc
+++ b/src/main.cc
@@ -41,7 +41,7 @@ static void sig_end(int signo)
exit(0);
}
-static void sig_user(int signo)
+static void sig_user1(int signo)
{
if (g_lb)
delete g_lb;
@@ -50,6 +50,13 @@ static void sig_user(int signo)
exit(0);
}
+static void sig_user2(int signo)
+{
+ //used to wake up the process
+ cerr << "User signal: " << signo << endl;
+ syslog(LOG_ERR, "wan_lb, user exit signal caught, exiting..");
+}
+
int main(int argc, char* argv[])
{
@@ -132,7 +139,8 @@ int main(int argc, char* argv[])
// sighup...
signal(SIGINT, sig_end);
signal(SIGTERM, sig_end);
- signal(SIGUSR1, sig_user);
+ signal(SIGUSR1, sig_user1);
+ signal(SIGUSR2, sig_user2);
//drop into event loop
do {