Browse Source

move connection declaration. cc @ericz

Michelle Bu 10 years ago
parent
commit
1a4cea3c6c
1 changed files with 2 additions and 1 deletions
  1. 2 1
      lib/peer.js

+ 2 - 1
lib/peer.js

@@ -174,6 +174,7 @@ Peer.prototype._handleMessage = function(message) {
   var type = message.type;
   var payload = message.payload;
   var peer = message.src;
+  var connection;
 
   switch (type) {
     case 'OPEN': // The connection to the server is open.
@@ -201,7 +202,7 @@ Peer.prototype._handleMessage = function(message) {
       break;
     case 'OFFER': // we should consider switching this to CALL/CONNECT, but this is the least breaking option.
       var connectionId = payload.connectionId;
-      var connection = this.getConnection(peer, connectionId);
+      connection = this.getConnection(peer, connectionId);
 
       if (connection) {
         util.warn('Offer received for existing Connection ID:', connectionId);