mirror of
https://github.com/danbulant/node-x11
synced 2026-05-21 05:19:14 +00:00
end event in client
This commit is contained in:
parent
5efa66ef34
commit
15bbd67965
1 changed files with 6 additions and 12 deletions
|
|
@ -1,12 +1,3 @@
|
|||
if (process.platform == 'darwin') {
|
||||
// some strage dns related errors in core node libs on OSX (node v0.6.5)
|
||||
// skip them at the moment
|
||||
process.on('uncaughtException', function (err) {
|
||||
console.log(err);
|
||||
console.log('Caught exception: ' + err);
|
||||
});
|
||||
}
|
||||
|
||||
var util = require('util'); // util.inherits
|
||||
var net = require('net');
|
||||
|
||||
|
|
@ -50,7 +41,7 @@ function XClient(stream, displayNum, screenNum)
|
|||
// flushed to stream as result of call to .flush
|
||||
// TODO: listen for drain event and flush automatically
|
||||
//pack_stream.pipe(stream);
|
||||
|
||||
var client = this;
|
||||
pack_stream.on('data', function( data ) {
|
||||
//console.error(hexy(data, {prefix: 'from packer '}));
|
||||
//for (var i=0; i < data.length; ++i)
|
||||
|
|
@ -61,7 +52,10 @@ function XClient(stream, displayNum, screenNum)
|
|||
//console.error(hexy(data, {prefix: 'to unpacker '}));
|
||||
//for (var i=0; i < data.length; ++i)
|
||||
// console.log('>>> ' + data[i]);
|
||||
pack_stream.write(data);
|
||||
pack_stream.write(data);
|
||||
});
|
||||
stream.on('end', function() {
|
||||
client.emit('end');
|
||||
});
|
||||
|
||||
this.pack_stream = pack_stream;
|
||||
|
|
@ -315,7 +309,7 @@ XClient.prototype.expectReplyHeader = function()
|
|||
var unpack = handler[0];
|
||||
var result = unpack( data, opt_data );
|
||||
var callback = handler[1];
|
||||
callback(result);
|
||||
callback(null, result);
|
||||
// TODO: add multiple replies flag and delete handler only after last reply (eg ListFontsWithInfo)
|
||||
delete client.replies[seq_num];
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue