agent.keepSocketAlive(socket)
socket
<stream.Duplex>
当 socket
从请求中分离并且可以由 Agent
持久化时调用。
默认行为是:
socket.setKeepAlive(true, this.keepAliveMsecs);
socket.unref();
return true;
此方法可以被特定的 Agent
子类覆盖。
如果此方法返回假值,则套接字将被销毁,而不是将其持久化以供下一个请求使用。
socket
参数可以是 <net.Socket>(<stream.Duplex> 的子类)的实例。
socket
<stream.Duplex>
Called when socket
is detached from a request and could be persisted by the
Agent
. Default behavior is to:
socket.setKeepAlive(true, this.keepAliveMsecs);
socket.unref();
return true;
This method can be overridden by a particular Agent
subclass. If this
method returns a falsy value, the socket will be destroyed instead of persisting
it for use with the next request.
The socket
argument can be an instance of <net.Socket>, a subclass of
<stream.Duplex>.