Skip to content

Commit 62132ac

Browse files
author
soletan
committed
Update lib/connection.js
1 parent 216dc41 commit 62132ac

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

lib/connection.js

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -299,29 +299,28 @@ p.readSslResponse = function() {
299299
};
300300

301301
p.parseMessage = function() {
302-
var remaining = this.buffer.length - (this.offset);
302+
var remaining = this.buffer.length - this.offset;
303303
if(remaining >= 5) {
304304
//read message id code
305305
var id = this.buffer[this.offset++];
306306
//read message length
307307
var length = this.parseInt32();
308308

309309
if(remaining > length) {
310-
var msg = {
311-
length: length
312-
};
313-
314310
if ( id in this.mapMsgNames ) {
315-
msg.name = this.mapMsgNames[id];
316-
var fnc = this["parse" + String.fromCharCode( id )];
317-
311+
var msg = {
312+
length: length,
313+
name: this.mapMsgNames[id]
314+
};
315+
316+
var fnc = this["parse" + String.fromCharCode( id )];
318317
return fnc instanceof Function ? fnc( msg ) : msg;
319-
} else {
320-
throw new Error("Unrecognized message code " + id);
321318
}
322-
} else {
323-
this.offset -= 5;
319+
320+
throw new Error("Unrecognized message code " + id);
324321
}
322+
323+
this.offset -= 5;
325324
}
326325

327326
//cannot read full response

0 commit comments

Comments
 (0)