node-multiplayer-snake icon indicating copy to clipboard operation
node-multiplayer-snake copied to clipboard

Crash after restarting while people are playing

Open alentoghostflame opened this issue 8 years ago • 0 comments

Expected Behavior

When I turn off the server while people are playing, then turn it back on, things should run back to normal.

Current Behavior

Sometimes crashes when starting up when you already have people attempting to connect.

Steps to Reproduce (for bugs)

  1. Start up server initially
  2. Have people connect and play on it
  3. Turn off server while people are connected and playing
  4. Turn server back on.

Your Environment

Chrome Version: 53.0.2785.144, node.js 7.0

The error I came across goes:

Express server listening on port 3000 in development mode /home/alento/snakegame/app/services/game-controls-service.js:42 const validNextDirections = this.getValidNextMove(player.directionBeforeMove); ^

TypeError: Cannot read property 'directionBeforeMove' of undefined at Function.handleKeyDown (/home/alento/snakegame/app/services/game-controls-service.js:42:65) at GameController._keyDown (/home/alento/snakegame/app/controllers/game-controller.js:146:29) at emitOne (events.js:96:13) at Socket.emit (events.js:188:7) at Socket.onevent (/home/alento/snakegame/node_modules/socket.io/lib/socket.js:348:8) at Socket.onpacket (/home/alento/snakegame/node_modules/socket.io/lib/socket.js:308:12) at /home/alento/snakegame/node_modules/socket.io/lib/client.js:195:16 at _combinedTickCallback (internal/process/next_tick.js:67:7) at process._tickCallback (internal/process/next_tick.js:98:9)

Note that playing normally works completely fine from what I can see, it's only when I'm restarting while people are playing that this occurs.

alentoghostflame avatar Nov 14 '16 15:11 alentoghostflame