Skip to content

Commit f1133b6

Browse files
committed
fix(client): Default to a hop count of 255 rather than 0
1 parent 7b6c618 commit f1133b6

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lib/client.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ const baNpdu = require('./npdu');
1313
const baBvlc = require('./bvlc');
1414
const baEnum = require('./enum');
1515

16-
const DEFAULT_HOP_COUNT = 0xFF;
1716
const BVLC_HEADER_LENGTH = 4;
1817

1918
/**

lib/npdu.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
const baEnum = require('./enum');
44

5+
const DEFAULT_HOP_COUNT = 0xFF;
56
const BACNET_PROTOCOL_VERSION = 1;
67
const BacnetAddressTypes = {
78
NONE: 0,
@@ -103,7 +104,7 @@ module.exports.encode = (buffer, funct, destination, source, hopCount, networkMs
103104
}
104105

105106
if (hasDestination) {
106-
buffer.buffer[buffer.offset++] = hopCount;
107+
buffer.buffer[buffer.offset++] = hopCount || DEFAULT_HOP_COUNT;
107108
}
108109

109110
if ((funct & baEnum.NpduControlBits.NETWORK_LAYER_MESSAGE) > 0) {

0 commit comments

Comments
 (0)