浏览代码

Merge pull request #75 from JBYoshi/localhost

Make IPv4 and IPv6 localhost connections use the same room.
RobinLinus 6 年之前
父节点
当前提交
c00ba60699
共有 1 个文件被更改,包括 4 次插入0 次删除
  1. 4 0
      server/index.js

+ 4 - 0
server/index.js

@@ -158,6 +158,10 @@ class Peer {
         } else {
         } else {
             this.ip = request.connection.remoteAddress;
             this.ip = request.connection.remoteAddress;
         }
         }
+        // IPv4 and IPv6 use different values to refer to localhost
+        if (this.ip == '::1' || this.ip == '::ffff:127.0.0.1') {
+            this.ip = '127.0.0.1';
+        }
     }
     }
 
 
     _setPeerId(request) {
     _setPeerId(request) {