mirror of
https://github.com/danbulant/node-x11
synced 2026-05-27 14:01:52 +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 util = require('util'); // util.inherits
|
||||||
var net = require('net');
|
var net = require('net');
|
||||||
|
|
||||||
|
|
@ -50,7 +41,7 @@ function XClient(stream, displayNum, screenNum)
|
||||||
// flushed to stream as result of call to .flush
|
// flushed to stream as result of call to .flush
|
||||||
// TODO: listen for drain event and flush automatically
|
// TODO: listen for drain event and flush automatically
|
||||||
//pack_stream.pipe(stream);
|
//pack_stream.pipe(stream);
|
||||||
|
var client = this;
|
||||||
pack_stream.on('data', function( data ) {
|
pack_stream.on('data', function( data ) {
|
||||||
//console.error(hexy(data, {prefix: 'from packer '}));
|
//console.error(hexy(data, {prefix: 'from packer '}));
|
||||||
//for (var i=0; i < data.length; ++i)
|
//for (var i=0; i < data.length; ++i)
|
||||||
|
|
@ -63,6 +54,9 @@ function XClient(stream, displayNum, screenNum)
|
||||||
// console.log('>>> ' + data[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;
|
this.pack_stream = pack_stream;
|
||||||
|
|
||||||
|
|
@ -315,7 +309,7 @@ XClient.prototype.expectReplyHeader = function()
|
||||||
var unpack = handler[0];
|
var unpack = handler[0];
|
||||||
var result = unpack( data, opt_data );
|
var result = unpack( data, opt_data );
|
||||||
var callback = handler[1];
|
var callback = handler[1];
|
||||||
callback(result);
|
callback(null, result);
|
||||||
// TODO: add multiple replies flag and delete handler only after last reply (eg ListFontsWithInfo)
|
// TODO: add multiple replies flag and delete handler only after last reply (eg ListFontsWithInfo)
|
||||||
delete client.replies[seq_num];
|
delete client.replies[seq_num];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue