Skip to content

Commit

Permalink
- Fixed error on the onError method.
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanpoeter committed Nov 26, 2016
1 parent 5aa56f1 commit 548a008
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/modbus-tcp-server-client.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ module.exports = stampit()

this.onSocketError = function (e) {
this.logError('Socker error', e)
}
}.bind(this)

init()
})
Expand Down
19 changes: 16 additions & 3 deletions test/heap-test-coils.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

const modbus = require('../')
const v8 = require('v8')
const Promise = require('bluebird')

const client = modbus.client.tcp.complete({
'host': 'localhost',
Expand All @@ -11,9 +12,21 @@ const client = modbus.client.tcp.complete({
client.connect()

client.on('connect', function () {
for (var i = 1; i < 1e5; i++) {
client.readCoils(0, 13)

let p = Promise.resolve()

for (let i = 1; i < 1e5; i++) {
p = p.then(client.readCoils(0, 13))
}

console.log('Heap:', Math.floor(v8.getHeapStatistics().used_heap_size / 1e6), 'MB')
p.then(function () {

let usedHeapSize = Math.floor(v8.getHeapStatistics().used_heap_size / 1e6);

console.log('Heap:', usedHeapSize, 'MB')

client.close()

})

})

0 comments on commit 548a008

Please sign in to comment.