mirror of
https://github.com/ChronosX88/KademliaDHT.git
synced 2024-11-21 17:52:21 +00:00
Added a method to check if the server is running
NodeLookupReceiver Only use the server if it's running
This commit is contained in:
parent
9e94a225fe
commit
807a9965d0
@ -221,7 +221,7 @@ public class KadServer
|
|||||||
}
|
}
|
||||||
catch (InterruptedException ex)
|
catch (InterruptedException ex)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -349,4 +349,9 @@ public class KadServer
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isRunning()
|
||||||
|
{
|
||||||
|
return this.isRunning;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -51,8 +51,11 @@ public class NodeLookupReceiver implements Receiver
|
|||||||
/* Respond to the NodeLookupMessage */
|
/* Respond to the NodeLookupMessage */
|
||||||
Message reply = new NodeReplyMessage(this.localNode.getNode(), nodes);
|
Message reply = new NodeReplyMessage(this.localNode.getNode(), nodes);
|
||||||
|
|
||||||
/* Let the Server send the reply */
|
if (this.server.isRunning())
|
||||||
this.server.reply(origin, reply, comm);
|
{
|
||||||
|
/* Let the Server send the reply */
|
||||||
|
this.server.reply(origin, reply, comm);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user