LiamKarlMitchell / InfiniteSky

InfiniteSky is an open-source mmorpg project, It is written in Node.JS
GNU General Public License v3.0
33 stars 42 forks source link

Some People get errors when client connects to there localhost, as if its IPv6 address. And some other issues #107

Closed LiamKarlMitchell closed 9 years ago

LiamKarlMitchell commented 9 years ago

http://stackoverflow.com/questions/24896386/request-connection-remoteaddress-now-prefixed-in-ffff-in-node-js

Error: Invalid byte: ::ffff:127
Tue Feb 24 2015 09:15:41 GMT+0200 (GTB Standard Time)
Stacktrace:
     at ip2long (C:\Users\Anostali\Documents\InfiniteSky\node_modules\netmask\li
b\netmask.js:19:44)
    at Netmask.contains (C:\Users\Anostali\Documents\InfiniteSky\node_modules\ne
tmask\lib\netmask.js:88:17)
    at Object.GameStart [as function] (C:\Users\Anostali\Documents\InfiniteSky\p
ackets\login\handleGameStart.js:38:27)
    at Socket.onData (C:\Users\Anostali\Documents\InfiniteSky\CachedBuffer.js:11
7:41)
    at Socket.<anonymous> (C:\Users\Anostali\Documents\InfiniteSky\CachedBuffer.
js:170:18)
    at Socket.emit (events.js:107:17)
    at readableAddChunk (_stream_readable.js:163:16)
    at Socket.Readable.push (_stream_readable.js:126:10)
    at TCP.onread (net.js:529:20)

Temp solution disable IPv6 from network settings.

LiamKarlMitchell commented 9 years ago

Add to util.js

// If for some reason an IPv6 address is given we want to strip off the
  // junk and just get our IPv4 address
  cleanIP: function(ip) {
    return ip.substr(ip.lastIndexOf(':')+1);
  },

And patch world and login etc to use it.

look for socket.remoteAddress and this.remoteAddress in world.js login.js and handleGameStart.js

LiamKarlMitchell commented 9 years ago

Fix error in CVec3 missing , Fix error in world.js addSocketToTransferQueue the setTimeout should just be setTimeout not socket.setTimeout.

LiamKarlMitchell commented 9 years ago

Resolved