1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2025-12-07 21:51:07 +01:00

Make writer/reader fields final in XMPPTCPConnection

This commit is contained in:
Florian Schmaus 2019-02-09 13:59:06 +01:00
parent 09bffb8dca
commit 60f324eb1b
2 changed files with 5 additions and 13 deletions

View file

@ -173,12 +173,12 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {
/**
* Protected access level because of unit test purposes
*/
protected PacketWriter packetWriter;
protected final PacketWriter packetWriter = new PacketWriter();
/**
* Protected access level because of unit test purposes
*/
protected PacketReader packetReader;
protected final PacketReader packetReader = new PacketReader();
private final SynchronizationPoint<Exception> initialOpenStreamSend = new SynchronizationPoint<>(
this, "initial open stream element send to server");
@ -642,17 +642,11 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {
* @throws InterruptedException
*/
private void initConnection() throws IOException, InterruptedException {
boolean isFirstInitialization = packetReader == null || packetWriter == null;
compressionHandler = null;
// Set the reader and writer instance variables
initReaderAndWriter();
if (isFirstInitialization) {
packetWriter = new PacketWriter();
packetReader = new PacketReader();
}
int availableReaderWriterSemaphorePermits = readerWriterSemaphore.availablePermits();
if (availableReaderWriterSemaphorePermits < 2) {
Object[] logObjects = new Object[] {