+
+ while ($ending) {
+ my $dxchan;
+
+ dbg("DXSpider Ending $ending");
+
+ unless ($io_disconnected++) {
+
+ # disconnect users
+ foreach $dxchan (DXChannel::get_all_users) {
+ $dxchan->disconnect;
+ }
+
+ # disconnect nodes
+ foreach $dxchan (DXChannel::get_all_nodes) {
+ next if $dxchan == $main::me;
+ $dxchan->disconnect(2);
+ }
+ $main::me->disconnect;
+ }
+
+ Mojo::IOLoop->stop if --$ending <= 0;
+ }