Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorBen Noordhuis <info@bnoordhuis.nl>2011-07-22 03:23:50 +0400
committerBen Noordhuis <info@bnoordhuis.nl>2011-07-22 03:23:50 +0400
commit984dc057e39b09443cb31345b256b596509a588d (patch)
tree52f315adbc106fe719339ba50da09733e02ae9cd /lib
parent345df289eb775aa2c195056ab88adf2c6ab95d66 (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.js9
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');
};