Emit error when handshake fails, such as with bad xauth

This commit is contained in:
Ian Scott 2016-05-13 18:26:40 -07:00
parent c694394b6d
commit a42f043768
2 changed files with 6 additions and 4 deletions

View file

@ -90,7 +90,7 @@ function readScreens(bl, display, cbDisplayReady)
if (display.screen.length == display.screen_num)
{
delete display.screen_num;
cbDisplayReady(display);
cbDisplayReady(null, display);
return;
} else {
readScreens(bl, display, cbDisplayReady);

View file

@ -531,10 +531,12 @@ XClient.prototype.startHandshake = function() {
var client = this;
handshake.writeClientHello(this.pack_stream, this.displayNum, this.authHost, this.authFamily);
handshake.readServerHello(this.pack_stream, function(display)
handshake.readServerHello(this.pack_stream, function(err, display)
{
// TODO: readServerHello can set error state in display
// emit error in that case
if (err) {
client.emit('error', err);
return;
}
client.expectReplyHeader();
client.display = display;
display.client = client;