Skip to content

Commit

Permalink
Log origin of unknown network packets
Browse files Browse the repository at this point in the history
  • Loading branch information
eibenp committed Jul 1, 2024
1 parent 59e0854 commit 0f17c31
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/platform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,12 @@ export class GreeACPlatform implements DynamicPlatformPlugin {
try{
message = JSON.parse(msg.toString());
} catch (e){
this.log.debug('handleMessage - unknown message - BASE64 encoded message: %s', Buffer.from(msg).toString('base64'));
this.log.debug('handleMessage - unknown message from %s - BASE64 encoded message: %s', rinfo.address.toString(),
Buffer.from(msg).toString('base64'));
return;
}
if (message.i !== 1 || message.t !== 'pack') {
this.log.debug('handleMessage - unknown response: %j', message);
this.log.debug('handleMessage - unknown response from %s: %j', rinfo.address.toString(), message);
return;
}
let pack, encryptionVersion:number;
Expand All @@ -150,11 +151,11 @@ export class GreeACPlatform implements DynamicPlatformPlugin {
encryptionVersion,
});
} else {
this.log.debug('handleMessage - unknown package: %j', pack);
this.log.debug('handleMessage - unknown package from %s: %j', rinfo.address.toString(), pack);
}
} catch (err) {
const msg = (err as Error).message;
this.log.error('handleMessage - Error:', msg);
this.log.error('handleMessage (%s) - Error: %s', rinfo.address.toString(), msg);
}
};

Expand Down

0 comments on commit 0f17c31

Please sign in to comment.