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)
- Start up server initially
- Have people connect and play on it
- Turn off server while people are connected and playing
- 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.