Skip to content

Commit

Permalink
- Changed new Buffer() to Buffer.alloc(1024, 0) in the Readme and in the
Browse files Browse the repository at this point in the history
  server core. new Buffer() is deprecated.
  • Loading branch information
stefanpoeter committed Dec 1, 2016
1 parent 078f554 commit 1287e99
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,9 @@ Server example
'responseDelay' : 10, // so we do not fry anything when someone is polling this server

// specify coils, holding and input register here as buffer or leave it for them to be new Buffer(1024)
coils : new Buffer(1024),
holding : new Buffer(1024),
input : new Buffer(1024)
coils : Buffer.alloc(1024, 0),
holding : Buffer.alloc(1024, 0),
input : Buffer.alloc(1024, 0)
})
.compose(modbus.server.tcp.complete)
.init(function () {
Expand Down
6 changes: 3 additions & 3 deletions src/modbus-server-core.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,19 @@ var core = stampit()

var init = function () {
if (!this.coils) {
coils = new Buffer(1024)
coils = Buffer.alloc(1024, 0)
} else {
coils = this.coils
}

if (!this.holding) {
holding = new Buffer(1024)
holding = Buffer.alloc(1024, 0)
} else {
holding = this.holding
}

if (!this.input) {
input = new Buffer(1024)
input = Buffer.alloc(1024, 0)
} else {
input = this.input
}
Expand Down

0 comments on commit 1287e99

Please sign in to comment.