summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOthmar Gsenger <otti@anytun.org>2008-02-28 14:45:36 +0000
committerOthmar Gsenger <otti@anytun.org>2008-02-28 14:45:36 +0000
commit14553064606f04e51a8bb0f846583a9e1bb6766d (patch)
treeb9076c2731d16c7a615fcc14329153ca238cf9d6
parentadded debug statement (diff)
bugfix empty routing table with existent connections
-rw-r--r--routingTable.cpp2
-rw-r--r--syncCommand.h4
-rw-r--r--syncSocket.cpp2
3 files changed, 5 insertions, 3 deletions
diff --git a/routingTable.cpp b/routingTable.cpp
index 29302fb..10a6041 100644
--- a/routingTable.cpp
+++ b/routingTable.cpp
@@ -80,6 +80,8 @@ void RoutingTable::delRoute(const NetworkPrefix & pref )
u_int16_t RoutingTable::getRoute(const NetworkAddress & addr)
{
Lock lock(mutex_);
+ if (routes_.empty())
+ return 0;
NetworkPrefix prefix(addr);
prefix.setNetworkPrefixLength(32);
RoutingMap::iterator it = routes_.lower_bound(prefix);
diff --git a/syncCommand.h b/syncCommand.h
index 09c98d2..9d10c76 100644
--- a/syncCommand.h
+++ b/syncCommand.h
@@ -35,12 +35,12 @@ private:
syncstr = "route";
}
ar & syncstr;
- std::cout << "syncstr received " <<syncstr << std::endl;
+// std::cout << "syncstr received " <<syncstr << std::endl;
if (syncstr == "connection")
ar & *scc_;
if (syncstr == "route")
ar & *src_;
- std::cout << "syncstr done " <<syncstr << std::endl;
+// std::cout << "syncstr done " <<syncstr << std::endl;
}
};
diff --git a/syncSocket.cpp b/syncSocket.cpp
index 0c55d46..ad7781b 100644
--- a/syncSocket.cpp
+++ b/syncSocket.cpp
@@ -35,7 +35,7 @@ void SyncSocket::OnAccept()
oa << scom;
Send(sout.str());
}
- sleep(5);
+ sleep(1);
if( ! gRoutingTable.empty())
{
std::ostringstream sout;