]> git.tdb.fi Git - netvis.git/blobdiff - source/netvis.cpp
Prevent crashing if the Resolver jams
[netvis.git] / source / netvis.cpp
index ff05507a2fc04364d31d1814037b9c247b1bdbbe..dce083706470e17b1600765d4a94ac9a415c433f 100644 (file)
@@ -135,10 +135,13 @@ void NetVis::tick()
                {
                        i->second->set_active(true);
                        hosts.insert(*i);
+                       for(unsigned j=0; j<100; ++j)
+                               i->second->tick(100*Time::msec);
                        disabled_hosts.erase(i++);
                }
                else if(i->second->get_activity()<del_limit)
                {
+                       resolver->cancel(i->second);
                        delete i->second;
                        disabled_hosts.erase(i++);
                }
@@ -248,6 +251,8 @@ Host &NetVis::get_host(unsigned a)
                host->set_local(true);
        resolver->push(host);
        host->set_position(Vector2(rand()*400.0/RAND_MAX-200.0, rand()*400.0/RAND_MAX-200.0));
+       for(unsigned j=0; j<100; ++j)
+               host->tick(100*Time::msec);
        hosts[a] = host;
        return *host;
 }