« get me outta code hell

mtui - Music Text User Interface - user-friendly command line music player
about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--telnet-server.js8
1 files changed, 4 insertions, 4 deletions
diff --git a/telnet-server.js b/telnet-server.js
index cda3323..6111d9d 100644
--- a/telnet-server.js
+++ b/telnet-server.js
@@ -46,7 +46,7 @@ class TelnetServer {
       socket.end()
       flushable.end()
       closed = true
-      this.sockets.splice(this.sockets.indexOf(socket, 1))
+      this.sockets.splice(this.sockets.indexOf(socket), 1)
     }
 
     appElement.on('quitRequested', quit)
@@ -56,7 +56,7 @@ class TelnetServer {
         clearInterval(renderInterval)
         flushable.end()
         closed = true
-        this.sockets.splice(this.sockets.indexOf(socket, 1))
+        this.sockets.splice(this.sockets.indexOf(socket), 1)
       }
     })
 
@@ -65,8 +65,8 @@ class TelnetServer {
   }
 
   disconnectAllSockets(msg) {
-    for (const socket of this.sockets) {
-      socket.quit(msg)
+    while (this.sockets.length) {
+      this.sockets[0].quit(msg)
     }
   }
 }