Skip to content

Commit 4d82106

Browse files
authored
Merge pull request #271 from DavidVujic/init-and-reset-noresponsecounter
Init and reset the noResponseCounter state variable
2 parents 51002d7 + faf50f7 commit 4d82106

File tree

7 files changed

+8
-3
lines changed

7 files changed

+8
-3
lines changed

examples/socketserver.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@ net.createServer((sock) => {
99

1010
sock.on('data', (data) => {
1111
console.log(`DATA ${sock.remoteAddress}: ${data}`);
12-
13-
sock.write(`You said "${data}"`);
12+
setInterval(() => {
13+
sock.write(`You said "${data}"`);
14+
}, 3000);
1415
});
1516

1617
sock.on('close', (data) => {

examples/wrapper.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ function createClient(timeoutMs = 5000) {
1818
const config = {
1919
connect: host,
2020
timeout: timeoutMs,
21-
debug_level: constants.ZOO_LOG_LEVEL_WARN,
21+
debug_level: constants.ZOO_LOG_LEVEL_INFO,
2222
host_order_deterministic: false,
2323
};
2424

prebuilds/darwin-x64/node.abi72.node

0 Bytes
Binary file not shown.

prebuilds/darwin-x64/node.abi83.node

0 Bytes
Binary file not shown.

prebuilds/win32-x64/node.abi72.node

0 Bytes
Binary file not shown.

prebuilds/win32-x64/node.abi83.node

0 Bytes
Binary file not shown.

src/node-zk.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -419,6 +419,8 @@ class ZooKeeper: public Nan::ObjectWrap {
419419
uv_timer_init(uv_default_loop(), &zk_timer);
420420
zk_timer.data = this;
421421

422+
noResponseCounter = 0;
423+
422424
yield();
423425
return true;
424426
}
@@ -1040,6 +1042,8 @@ class ZooKeeper: public Nan::ObjectWrap {
10401042
// Unrefing after is important to avoid memory being freed too early.
10411043
uv_close((uv_handle_t*) &zk_timer, timer_closed);
10421044

1045+
noResponseCounter = 0;
1046+
10431047
Nan::HandleScope scope;
10441048
DoEmitClose (Nan::New(on_closed), code);
10451049
}

0 commit comments

Comments
 (0)