Skip to content

Commit

Permalink
Create const for secure event
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-pbulawa committed Sep 22, 2023
1 parent 2991409 commit 9526f34
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/agent/socket_util.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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());

Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit 9526f34

Please sign in to comment.