Print "unknown peer" instead of null, if no RPC peer is known

This commit is contained in:
Andrew Ferrazzutti 2022-05-10 01:16:03 -04:00
parent 652aa22048
commit 3f8660a3c4

View File

@ -422,7 +422,7 @@ export default class PeerClient {
this.stopped = false this.stopped = false
this.notificationID = 0 this.notificationID = 0
this.maxCommandID = 0 this.maxCommandID = 0
this.peerID = null this.peerID = ""
this.deviceName = "KakaoTalk Bridge" this.deviceName = "KakaoTalk Bridge"
/** @type {[string]} */ /** @type {[string]} */
this.loggingKeys = [] this.loggingKeys = []
@ -483,11 +483,11 @@ export default class PeerClient {
if (this.peerID && this.manager.clients.get(this.peerID) === this) { if (this.peerID && this.manager.clients.get(this.peerID) === this) {
this.manager.clients.delete(this.peerID) this.manager.clients.delete(this.peerID)
} }
this.log(`Connection closed (peer: ${this.peerID})`) this.log(`Connection closed (peer: ${this.peerID || "unknown peer"})`)
} }
#closeUsers() { #closeUsers() {
this.log("Closing all API clients for", this.peerID) this.log(`Closing all API clients for ${this.peerID || "unknown peer"}`)
for (const userClient of this.userClients.values()) { for (const userClient of this.userClients.values()) {
userClient.disconnect() userClient.disconnect()
} }