Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
wolf4ood committed Sep 25, 2019
1 parent ed28baf commit 0486794
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
1 change: 1 addition & 0 deletions lib/client/database/session.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ class SessionManager {
data.token = session.token;
data.sessionId = session.sessionId;
data.database = this.name;
data._session = session;
data.db = this;
data.transformerFunctions = db.transformerFunctions;
this.client.logger.debug(
Expand Down
12 changes: 8 additions & 4 deletions lib/client/network/protocol37/operation.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ Operation.prototype.buffer = function() {
size += item[0];
}

buffer = Buffer.alloc(size);
buffer = Buffer.alloc(size);

for (i = 0; i < total; i++) {
item = commands[i];
Expand Down Expand Up @@ -305,7 +305,7 @@ Operation.prototype.writeVarintString = function(data) {
};

function encodeString(data) {
return Buffer.from(data);
return Buffer.from(data);
}

// # Read Operations
Expand All @@ -330,7 +330,11 @@ Operation.prototype.readStatus = function(fieldName, reader) {
this.readByte("code");

this.readInt("sessionId");
this.readBytes("token");
this.readBytes("token", data => {
if (data.token && data.token.length > 0 && this.data._session) {
this.data._session.token = data.token;
}
});
this.readByte("op", next);

return this;
Expand Down Expand Up @@ -591,7 +595,7 @@ Operation.prototype.parseLivePush = function(buffer, offset, result) {
offset += 1;
let length = buffer.readInt32BE(offset);
offset += 4;
let recordBuffer = Buffer.alloc(length);
let recordBuffer = Buffer.alloc(length);
buffer.copy(recordBuffer, 0, offset, offset + length);
offset += length;
event.data = deserializer.deserialize(
Expand Down

0 comments on commit 0486794

Please sign in to comment.