RanvierMUD / ranviermud

A node.js based MUD game engine
https://ranviermud.com
MIT License
796 stars 247 forks source link

repeat() not working as expected #74

Closed marado closed 7 years ago

marado commented 7 years ago

Example: you try to type just 'enter' on your password prompt:

Welcome, what is your name? asd
Do you want your account's username to be Asd? [y/n] y
Creating account...
Your password must be between 6 and 30 characters.
Enter your account password: 
You must use a password.
Connection closed by foreign host.

This is what happened:

  TypeError: Cannot read property 'apply' of undefined

  - EventUtil.js:19 
    /home/marado/github/ranviermud/src/EventUtil.js:19:16

  - EventUtil.js:30 
    /home/marado/github/ranviermud/src/EventUtil.js:30:10

I could submit a patch to avoid the use of repeat(), but it seems to me that the function should be fixed instead, and I think probably you know better on what were your intentions regarding that code, so I'll leave it to you.

shawncplus commented 7 years ago

Closed with #73

marado commented 7 years ago

Seems to still be failing...

shawncplus commented 7 years ago

Gonna need more info than that, it's working for me

marado commented 7 years ago

After a simple clone of the staging branch and an npm install, I ran ./ranvier -v --save=10 --respawn=10 --port=8888 and, in another terminal, I did this:

marado@eledeb:~/github/ranviermud$ telnet 0 8888
Trying 0.0.0.0...
Connected to 0.
Escape character is '^]'.
Connecting...
RanvierMUD Codebase - Version 0.4.1
Shawn Biddle - Sean O'Donohue

                         _
                        (_)
    _ __ __ _ _ ____   ___  ___ _ __
   | '__/ _` | '_ \ \ / / |/ _ \ '__|    . ' .
   | |   (_| | | | \ V /| |  __/ |   . '       ' .
   |_|  \__,_|_| |_|\_/ |_|\___|_|  |     _ __    |
                                    |    | '__|   |
   Barebones Node.js-based codebase |    | |      |
   github.com/shawncplus/ranviermud |    |_|      |
                                     ' .       . '
                                         ' . '

Welcome, what is your name? marado
Do you want your account's username to be Marado? [y/n] y
Creating account...
Your password must be between 6 and 30 characters.
Enter your account password: 
You must use a password.
Connection closed by foreign host.
marado@eledeb:~/github/ranviermud$ 

Notice that means I simply pressed Enter when a password was asked. The stacktrace:

11 Jan 00:26:06 - Server started on port: 8888 ...
11 Jan 00:26:16 - User connected...
11 Jan 00:26:18 - No account found
  TypeError: Cannot read property 'apply' of undefined

  - EventUtil.js:19 
    /home/marado/github/ranviermud/src/EventUtil.js:19:16

  - EventUtil.js:30 
    /home/marado/github/ranviermud/src/EventUtil.js:30:10

  - createAccount.js:55 TelnetStream.socket.once.pass
    /home/marado/github/ranviermud/bundles/core-input-events/input-events/createAccount.js:55:22

  - Telnet.js:182 TelnetStream.input
    /home/marado/github/ranviermud/src/Telnet.js:182:10

  - Telnet.js:130 Socket.connection.on
    /home/marado/github/ranviermud/src/Telnet.js:130:12

  - ---------------------------------------------

  - createAccount.js:48 TelnetStream.<anonymous>
    /home/marado/github/ranviermud/bundles/core-input-events/input-events/createAccount.js:48:18

  - EventUtil.js:19 
    /home/marado/github/ranviermud/src/EventUtil.js:19:17

  - createAccount.js:31 TelnetStream.socket.once.data
    /home/marado/github/ranviermud/bundles/core-input-events/input-events/createAccount.js:31:22

marado@eledeb:~/github/ranviermud$

A console.dir(socket) at the time of the crash simply prints {}.

shawncplus commented 7 years ago

Was able to replicate, it was specifically when not typing in a valid password. Due to this issue and others I've created #86 which will be the real fix for this