mirror of
https://github.com/DeviceFarmer/stf.git
synced 2026-04-18 08:13:31 +02:00
Set TCP_KEEPALIVE socket option to fix tcp_connection problem in
some network. Issue-100
This commit is contained in:
14
lib/util/zmqutil.js
Normal file
14
lib/util/zmqutil.js
Normal file
@@ -0,0 +1,14 @@
|
||||
// ISSUE-100 (https://github.com/openstf/stf/issues/100)
|
||||
|
||||
// In some networks TCP Connection dies if kept idle for long.
|
||||
// Setting TCP_KEEPALIVE option true, to all the zmq sockets
|
||||
// won't let it die
|
||||
|
||||
var zmq = require('zmq')
|
||||
|
||||
module.exports.socket = function() {
|
||||
var sock = zmq.socket.apply(zmq, arguments)
|
||||
sock.setsockopt(zmq.ZMQ_TCP_KEEPALIVE, 1)
|
||||
sock.setsockopt(zmq.ZMQ_TCP_KEEPALIVE_IDLE, 300000)
|
||||
return sock
|
||||
}
|
||||
Reference in New Issue
Block a user