From 124ad6a95cd6a04ed57d9abc018a09952cd5f257 Mon Sep 17 00:00:00 2001 From: Victor Boivie Date: Sat, 8 Jul 2017 13:21:55 +0200 Subject: [PATCH] THRIFT-4246 Multiplexed clients sequence id fix Client: nodejs Previously, all clients would use the latest created multiplexer for generating sequence numbers which would create a mismatch between the mapping of sequence number->service in the connection. This makes the client instances use the multiplexer that is bound to it. --- lib/nodejs/lib/thrift/multiplexed_protocol.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/nodejs/lib/thrift/multiplexed_protocol.js b/lib/nodejs/lib/thrift/multiplexed_protocol.js index 9caf6ab52a9..d078aa2266f 100644 --- a/lib/nodejs/lib/thrift/multiplexed_protocol.js +++ b/lib/nodejs/lib/thrift/multiplexed_protocol.js @@ -52,17 +52,17 @@ Multiplexer.prototype.createClient = function(serviceName, ServiceClient, connec if (ServiceClient.Client) { ServiceClient = ServiceClient.Client; } - var self = this; - ServiceClient.prototype.new_seqid = function() { - self.seqid += 1; - return self.seqid; - }; var writeCb = function(buf, seqid) { connection.write(buf,seqid); }; var transport = new connection.transport(undefined, writeCb); var protocolWrapper = new Wrapper(serviceName, connection.protocol, connection); var client = new ServiceClient(transport, protocolWrapper); + var self = this; + client.new_seqid = function() { + self.seqid += 1; + return self.seqid; + }; if (typeof connection.client !== 'object') { connection.client = {};