pingflood.js 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #!/usr/bin/env node
  2. /* vim: set expandtab ts=4 sw=4: */
  3. /*
  4. * You may redistribute this program and/or modify it under the terms of
  5. * the GNU General Public License as published by the Free Software Foundation,
  6. * either version 3 of the License, or (at your option) any later version.
  7. *
  8. * This program is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU General Public License for more details.
  12. *
  13. * You should have received a copy of the GNU General Public License
  14. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  15. */
  16. /*
  17. * test the admin port
  18. */
  19. var Cjdns = require('../cjdnsadmin/cjdnsadmin');
  20. var nThen = require('../cjdnsadmin/nthen');
  21. Cjdns.connectWithAdminInfo(function (cjdns) {
  22. nThen(function (waitFor) {
  23. for (var i = 0; i < 10000; i++) {
  24. cjdns.RouterModule_pingNode('0000.0000.0000.0001', waitFor(function (err, ret) {
  25. if (err) { throw err; }
  26. }));
  27. }
  28. }).nThen(function (waitFor) {
  29. cjdns.disconnect();
  30. });
  31. });