Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions lib/bus.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,16 @@ module.exports = function bus(conn, opts) {
this.connection.message(reply);
};

this.connection.on('end', function() {
// complete all pending callbacks with error
var handler;
for (var cookie in self.cookies) {
handler = self.cookies[cookie];
delete self.cookies[cookie];
handler(new Error("connection was closed"));
}
});

// route reply/error
this.connection.on('message', function(msg) {
var handler;
Expand Down