X-Git-Url: https://git.wh0rd.org/?p=chrome-ext%2Fmusic-player-client.git;a=blobdiff_plain;f=js%2Ftcp-client.js;h=dd0c189dc62a7a711bd11c8cfbf649b854b5b0eb;hp=ec61399b49ce12b1be0a3e15422a5f417b3da71f;hb=c7400cad8000d7fd659ec3259e6bed1c2cdc9c0a;hpb=fac1d77114bffa0716586ac32e64772bb24fb40a diff --git a/js/tcp-client.js b/js/tcp-client.js index ec61399..dd0c189 100644 --- a/js/tcp-client.js +++ b/js/tcp-client.js @@ -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));