Skip to content
Snippets Groups Projects
Commit d7918637 authored by rswindell's avatar rswindell
Browse files

If the poll_systems() callback function returns true, abort the poll.

parent af98a9d0
No related branches found
No related tags found
No related merge requests found
......@@ -144,14 +144,15 @@ function receive_active_users()
return sock.recvfrom(0x10000);
}
// Cancel listening if callback returns 'true'
function poll_systems(sent, interval, timeout, callback)
{
var replies = 0;
var begin = new Date();
for(var loop = 0; replies < sent && new Date().valueOf()-begin.valueOf() < timeout; loop++)
{
if(callback)
callback(loop);
if(callback && callback(loop))
break;
if(!sock.poll(interval))
continue;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment