Skip to content

Commit

Permalink
you will now get an response even if the packet failed
Browse files Browse the repository at this point in the history
  • Loading branch information
EdvinErikson committed Oct 1, 2014
1 parent 6b43366 commit 2f56d98
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions lib/Connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,14 @@ Connection.prototype.begin = function(cb) {
this.emit('admin.event', packet.getResponse(), packet);
} else {
var seq = packet.getSequence();
if(packet.isOK()) {
if(this.packets[seq].callback !== undefined) {
this.packets[seq].callback(packet);
packet = null;
}
} else {
if(this.packets[seq].callback !== undefined) {
this.packets[seq].callback(packet);
}
if(!packet.isOK()) {
var requestPacket = this.packets[seq].packet;
this.emit('command.error', requestPacket.getWord(0), packet.getResponse(), requestPacket, packet)
}

packet = null;
delete this.packets[seq];
}
this.packetOffset = 0;
Expand Down

0 comments on commit 2f56d98

Please sign in to comment.