summaryrefslogtreecommitdiff
path: root/Ivy/IvyWatcher.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Ivy/IvyWatcher.cxx')
-rw-r--r--Ivy/IvyWatcher.cxx8
1 files changed, 8 insertions, 0 deletions
diff --git a/Ivy/IvyWatcher.cxx b/Ivy/IvyWatcher.cxx
index 4cbf604..ab72511 100644
--- a/Ivy/IvyWatcher.cxx
+++ b/Ivy/IvyWatcher.cxx
@@ -15,6 +15,7 @@
IvyWatcher::IvyWatcher(Ivy * bus)
{
+ running = false;
this->bus = bus;
}
IvyWatcher::~IvyWatcher()
@@ -97,6 +98,11 @@ void IvyWatcher::start(const char *domainlist)
}
// create UDP receiver
// catch exception !!!
+ // if already open then CLOSE
+ if ( running )
+ {
+ Close();
+ }
Socket(SOCK_DGRAM);
SetSockOpt( SO_REUSEADDR, &reuse, sizeof(BOOL) );
Bind(port);
@@ -117,8 +123,10 @@ void IvyWatcher::start(const char *domainlist)
AddMember( addr.c_str() );
SendTo( hello, len, port, addr.c_str() );
}
+ running = true;
}
void IvyWatcher::stop()
{
Close();
+ running = false;
}