Skip to content

Commit

Permalink
More debug info for network
Browse files Browse the repository at this point in the history
  • Loading branch information
aholstenson committed Jan 27, 2018
1 parent 554b220 commit 68c452f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/network.js
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,11 @@ class DeviceInfo {
this.debug('Loading token from storage, device hides token and no token set via options');
this.autoToken = false;
promise = tokens.get(this.id)
.then(token => this.token = Buffer.from(token, 'hex'));
.then(token => {
this.debug('Using stored token:', token);
this.packet.token = Buffer.from(token, 'hex');
this.tokenChanged = true;
});
} else {
if(this.tokenChanged) {
this.autoToken = false;
Expand Down Expand Up @@ -492,6 +496,7 @@ class DeviceInfo {
if(retriesLeft-- > 0) {
send();
} else {
this.debug('Reached maximum number of retries, giving up');
const err = new Error('Call to device timed out');
err.code = 'timeout';
promise.reject(err);
Expand Down

0 comments on commit 68c452f

Please sign in to comment.