Michelle Bu преди 12 години
родител
ревизия
e20c74789a
променени са 1 файла, в които са добавени 4 реда и са изтрити 3 реда
  1. 4 3
      lib/server.js

+ 4 - 3
lib/server.js

@@ -270,7 +270,7 @@ PeerServer.prototype._handleTransmission = function(message, res) {
               type: 'EXPIRE',
               src: dst,
               dst: src
-            });   
+            });
           }
         }, this._options.timeout);
       }
@@ -279,10 +279,11 @@ PeerServer.prototype._handleTransmission = function(message, res) {
     } else if (type === 'LEAVE' && !dst) {
       this._removePeer(src);
       if (!!res) res.send(200);
-    } else {
+    } else if (src) {
       // Assume a disconnect if the client no longer exists.
+      // Unless it's a message from the server.
       this._handleTransmission({
-        type: 'LEAVE',
+        type: 'EXPIRE',
         src: dst,
         dst: src
       });