Skip to content
This repository has been archived by the owner on Jun 29, 2023. It is now read-only.

Commit

Permalink
Guard GelfTCPSSLSender.closeSocketChannel against uninitialized SSLEn…
Browse files Browse the repository at this point in the history
…gine #111

Do not interact with SSLEngine if SSLEngine is not available. This can happen if the sender is closed without establishing a connection prior closing.

Original pull request: #112.
  • Loading branch information
Badreddine BENAIDJA authored and mp911de committed Mar 15, 2017
1 parent a8d749e commit 0125d27
Showing 1 changed file with 6 additions and 4 deletions.
Expand Up @@ -261,9 +261,11 @@ public void close() {
}

private void closeSocketChannel() throws IOException {

sslEngine.closeOutbound();
doHandshake(channel(), sslEngine, ByteBuffer.allocate(sslSession.getPacketBufferSize()),
ByteBuffer.allocate(sslSession.getPacketBufferSize()));

if(sslEngine != null){
sslEngine.closeOutbound();
doHandshake(channel(), sslEngine, ByteBuffer.allocate(sslSession.getPacketBufferSize()),
ByteBuffer.allocate(sslSession.getPacketBufferSize()));
}
}
}

0 comments on commit 0125d27

Please sign in to comment.