catch socket connection error
This commit is contained in:
parent
b1b3be5e22
commit
836faee834
@ -2,7 +2,7 @@
|
|||||||
"main": "plugin.js",
|
"main": "plugin.js",
|
||||||
"name": "syncplay",
|
"name": "syncplay",
|
||||||
"description": "Syncplay Service for Squeebot 3",
|
"description": "Syncplay Service for Squeebot 3",
|
||||||
"version": "1.0.2",
|
"version": "1.0.3",
|
||||||
"tags": ["service", "syncplay"],
|
"tags": ["service", "syncplay"],
|
||||||
"dependencies": ["control?"],
|
"dependencies": ["control?"],
|
||||||
"npmDependencies": []
|
"npmDependencies": []
|
||||||
|
@ -196,16 +196,22 @@ class SyncplayProtocol extends Protocol {
|
|||||||
password = crypto.createHash('md5').update(password).digest('hex');
|
password = crypto.createHash('md5').update(password).digest('hex');
|
||||||
}
|
}
|
||||||
|
|
||||||
this.socket = net.connect(opts, () => {
|
try {
|
||||||
this.write({
|
this.socket = net.connect(opts, () => {
|
||||||
Hello: {
|
this.write({
|
||||||
username: this.config.syncplay.name,
|
Hello: {
|
||||||
password,
|
username: this.config.syncplay.name,
|
||||||
room: { name: this.config.syncplay.room },
|
password,
|
||||||
version: PROTOCOL_VERSION
|
room: { name: this.config.syncplay.room },
|
||||||
}
|
version: PROTOCOL_VERSION
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
} catch(err: any) {
|
||||||
|
this.emit('error', err);
|
||||||
|
this.stop(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
let buffer: any = '';
|
let buffer: any = '';
|
||||||
this.socket.on('data', (chunk) => {
|
this.socket.on('data', (chunk) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user