Commit 354ca192 authored by hanfeng's avatar hanfeng

[trac388] add check to avoid stop server twice

parent 8f331c78
172. [func] feng
Add stop interface into dns server, so we can stop each running
server individually.With it, user can reconfigure its running server
with different ip address or port.
171. [func] feng, jerry, jinmei, vorner
b10-auth, src/lib/datasrc: in memory data source now works as a
complete data source for authoritative DNS servers and b10-auth
......
......@@ -189,6 +189,10 @@ TCPServer::asyncLookup() {
}
void TCPServer::stop() {
//server should not be stopped twice
if (stopped_by_hand_)
return;
stopped_by_hand_ = true;
acceptor_->close();
socket_->close();
......
......@@ -281,6 +281,9 @@ UDPServer::asyncLookup() {
/// Stop the UDPServer
void
UDPServer::stop() {
//server should not be stopped twice
if (data_->stopped_by_hand_)
return;
data_->stopped_by_hand_ = true;
data_->socket_->close();
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment