diff --git a/lib/agent/socket_util.js b/lib/agent/socket_util.js index 1b5e5fdea..e3868a652 100644 --- a/lib/agent/socket_util.js +++ b/lib/agent/socket_util.js @@ -18,6 +18,8 @@ const ocspFailOpenWarning = 'without OCSP based Certificated Revocation checking as it could not obtain a valid OCSP Response to use from ' + 'the CA OCSP responder. Details: '; +const socketSecuredEvent = 'secureConnect'; + const rawOcspFlag = process.env.SF_OCSP_RESPONSE_CACHE_SERVER_ENABLED; @@ -72,7 +74,7 @@ exports.secureSocket = function (socket, host, agent, mock) const validate = function () { // stop listening for the secure event - socket.removeListener('secureConnect', validate); + socket.removeListener(socketSecuredEvent, validate); Logger.getInstance().trace('socket reused = %s', socket.isSessionReused()); @@ -112,7 +114,7 @@ exports.secureSocket = function (socket, host, agent, mock) }; // when the socket is secure, perform additional validation - socket.on('secureConnect', validate); + socket.on(socketSecuredEvent, validate); // block all writes until validation is complete socket.cork();