diff --git a/src/services/DebugServer.js b/src/services/DebugServer.js
index <HASH>..<HASH> 100644
--- a/src/services/DebugServer.js
+++ b/src/services/DebugServer.js
@@ -44,7 +44,7 @@ module.exports = class DebugServer {
       }
       if (this._connection) {
         if (address === this._connection.address) {
-          return this._connection.open(webSocket, serverId);
+          return this._connection.open(webSocket, sessionId);
         }
         if (sessionId < this._connection.sessionId) {
           return webSocket.close(OUTDATED_CONNECTION_CLOSURE);
@@ -104,6 +104,9 @@ module.exports = class DebugServer {
   }
 
   _onDisconnect(connection) {
+    if (this._printStateTimer !== -1) {
+      clearTimeout(this._printStateTimer);
+    }
     this._printStateTimer = setTimeout(() => {
       this._printStateTimer = -1;
       this._printClientState(connection.device, STATE_DISCONNECTED);
Fix wrong session ID and unexpected disconnect log

A connection could close and open in a short timespan, leading to the
disconnect callback being called multiple times. This sometimes resulted
into an outdated timeout handler being unexpectedly executed after a
successful connection, leading to a "disconnected" message being printed
to the console, although a connection was already open.

Change-Id: I<I>a4e5dea<I>defb<I>fd<I>cff<I>e<I>a8fa9