Skip to content

Commit

Permalink
fix(miio): Bind dummycloud after setting event listeners (#741)
Browse files Browse the repository at this point in the history
Fixes race-condition that may cause the Dummycloud debug information to
not be printed.
  • Loading branch information
depau authored Mar 5, 2021
1 parent 7987168 commit 2aba77e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/miio/Dummycloud.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,13 @@ class Dummycloud {
this.bindIP = options.bindIP;

this.socket = dgram.createSocket("udp4");
this.socket.bind(Dummycloud.PORT, this.bindIP);

this.socket.on("listening", () => {
Logger.info("Dummycloud is spoofing " + this.spoofedIP + ":8053 on " + this.bindIP + ":" + Dummycloud.PORT);
});

this.socket.bind(Dummycloud.PORT, this.bindIP);

this.miioSocket = new MiioSocket({
socket: this.socket,
token: options.cloudSecret,
Expand Down

0 comments on commit 2aba77e

Please sign in to comment.