mirror of
https://github.com/openstf/stf
synced 2025-10-04 02:09:32 +02:00
Output a warning instead of crashing if ZMQ library is too old to
support TCP keepalive options. Fixes #109.
This commit is contained in:
parent
2a5a7bae9a
commit
b248e96dc2
1 changed files with 11 additions and 2 deletions
|
@ -6,9 +6,18 @@
|
|||
|
||||
var zmq = require('zmq')
|
||||
|
||||
var log = require('./logger').createLogger('util:zmqutil')
|
||||
|
||||
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)
|
||||
|
||||
try {
|
||||
sock.setsockopt(zmq.ZMQ_TCP_KEEPALIVE, 1)
|
||||
sock.setsockopt(zmq.ZMQ_TCP_KEEPALIVE_IDLE, 300000)
|
||||
}
|
||||
catch (err) {
|
||||
log.warn('ZeroMQ library too old, no support for TCP keepalive options')
|
||||
}
|
||||
|
||||
return sock
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue