images: update small tile to try & pass CWS guidelines
[chrome-ext/music-player-client.git] / js / tcp-client.js
index ec61399b49ce12b1be0a3e15422a5f417b3da71f..dd0c189dc62a7a711bd11c8cfbf649b854b5b0eb 100644 (file)
@@ -110,6 +110,9 @@ Author: Boris Smus (smus@chromium.org)
    * @param {Object} createInfo The socket details
    */
   TcpClient.prototype._onCreate = function(createInfo) {
+    if (this.socketId !== null) {
+      socket.destroy(this.socketId);
+    }
     this.socketId = createInfo.socketId;
     if (this.socketId > 0) {
       socket.connect(this.socketId, this.host, this.port, this._onConnectComplete.bind(this));