telnet-client
Advanced tools
Comparing version 1.0.2 to 1.0.3
@@ -18,3 +18,4 @@ 'use strict' | ||
connect(opts) { | ||
return new Promise((resolve, reject) => { | ||
let promise | ||
return promise = new Promise((resolve, reject) => { | ||
const host = (typeof opts.host !== 'undefined' ? opts.host : '127.0.0.1') | ||
@@ -75,3 +76,3 @@ const port = (typeof opts.port !== 'undefined' ? opts.port : 23) | ||
this.socket.setTimeout(this.timeout, () => { | ||
if (this.socket._connecting === true) { | ||
if (promise.isPending()) { | ||
/* if cannot connect, emit error and destroy */ | ||
@@ -93,3 +94,3 @@ if (this.listeners('error').length > 0) | ||
this._parseData(data, (event, parsed) => { | ||
if (event === 'ready') { | ||
if (promise.isPending() && event === 'ready') { | ||
resolve(parsed) | ||
@@ -103,2 +104,4 @@ } | ||
this.emit('error', error) | ||
if (promise.isPending()) | ||
reject(error) | ||
@@ -109,2 +112,5 @@ }) | ||
this.emit('end') | ||
if (promise.isPending()) | ||
reject(new Error('Socket ends')) | ||
}) | ||
@@ -114,2 +120,5 @@ | ||
this.emit('close') | ||
if (promise.isPending()) | ||
reject(new Error('Socket closes')) | ||
}) | ||
@@ -116,0 +125,0 @@ }) |
@@ -8,3 +8,3 @@ { | ||
}, | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"main": "./lib/index.js", | ||
@@ -19,3 +19,2 @@ "engine": "node >= 6.9.1", | ||
"extend": "^3.0.2", | ||
"jscoverage": "^0.6.x", | ||
"nodeunit": "^0.11.3", | ||
@@ -22,0 +21,0 @@ "telnet": "0.0.1" |
[![GitHub license](https://img.shields.io/github/license/mashape/apistatus.svg)](https://github.com/mkozjak/node-telnet-client/blob/master/LICENSE) | ||
[![Build Status](https://travis-ci.org/mkozjak/node-telnet-client.svg?branch=master)](https://travis-ci.org/mkozjak/node-telnet-client) | ||
[![Coverage Status](https://coveralls.io/repos/mkozjak/node-telnet-client/badge.svg?branch=master)](https://coveralls.io/r/mkozjak/node-telnet-client?branch=master) | ||
[![npm](https://img.shields.io/npm/dm/telnet-client.svg?maxAge=2592000)](https://www.npmjs.com/package/telnet-client) | ||
[![Donate Bitcoin/Altcoins](https://img.shields.io/badge/donate-coins-blue.svg)](https://mario.kozjak.io/donate) | ||
[![NPM](https://nodei.co/npm/telnet-client.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/telnet-client/) | ||
[![npm version](https://img.shields.io/npm/v/telnet-client.svg?style=flat)](https://www.npmjs.com/package/telnet-client) | ||
@@ -8,0 +7,0 @@ # node-telnet-client |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
46873
4
1023
331