diff options
author | Ben Noordhuis <info@bnoordhuis.nl> | 2011-07-22 03:23:50 +0400 |
---|---|---|
committer | Ben Noordhuis <info@bnoordhuis.nl> | 2011-07-22 03:23:50 +0400 |
commit | 984dc057e39b09443cb31345b256b596509a588d (patch) | |
tree | 52f315adbc106fe719339ba50da09733e02ae9cd /lib | |
parent | 345df289eb775aa2c195056ab88adf2c6ab95d66 (diff) |
net_uv: throw if Server.prototype.close() is called twice
Follows net_legacy behaviour.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/net_uv.js | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/net_uv.js b/lib/net_uv.js index 354b9860458..2c9df4b739b 100644 --- a/lib/net_uv.js +++ b/lib/net_uv.js @@ -631,10 +631,13 @@ function onconnection(clientHandle) { Server.prototype.close = function() { - if (this._handle != null) { - this._handle.close(); - this._handle = null; + if (!this._handle) { + // Throw error. Follows net_legacy behaviour. + throw new Error('Not running'); } + + this._handle.close(); + this._handle = null; this.emit('close'); }; |