0

当我尝试启动我的脚本时,我不断收到错误消息。如果我删除调用“check();”的行 然后它工作正常。

错误: node: ../src/node_io_watcher.cc:160: static v8::Handle node::IOWatcher::Set(const v8::Arguments&): Assertion `!io->watcher_.active' 失败。

我相信我使用的是第 6 版。

失败的代码如下

function check(){
  hosts.forEach(function(item) {
    var sock = new net.Socket();
    sock.setTimeout(7500);
    ports.forEach(function(item1) {
      sock.on('connect', function() {
          console.log(item[0]+':'+item1[1]+' is up.');
          sock.destroy();
          serverstatus[item[1]][item1[0]] = "online";
      }).on('error', function(e) {
          console.log(item[0]+':'+item1[1]+' is down: ' + e.message);
          serverstatus[item[1]][item1[0]] = "offline";
      }).on('timeout', function(e) {
          console.log(item[0]+':'+item1[1]+' is down: timeout');
          serverstatus[item[1]][item1[0]] = "timeout";
      }).connect(item1[1], item[0]);
    });
  });
}
4

0 回答 0