Skip to content

Commit

Permalink
Add support for multi-reply handlers
Browse files Browse the repository at this point in the history
  • Loading branch information
real-alexei committed Apr 27, 2015
1 parent e7d9ba7 commit 624e8df
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/xcore.js
Original file line number Diff line number Diff line change
Expand Up @@ -506,9 +506,11 @@ XClient.prototype.expectReplyHeader = function()

var result = unpack.call(client, data, opt_data);
var callback = handler[1];
callback(null, result);
// TODO: add multiple replies flag and delete handler only after last reply (eg ListFontsWithInfo)
delete client.replies[seq_num];
var multiReply = handler[2];
var handled = callback(null, result);
if (!multiReply || handled) {
delete client.replies[seq_num];
}
}
// wait for new packet from server
client.expectReplyHeader();
Expand Down

0 comments on commit 624e8df

Please sign in to comment.