Skip to content

Commit 0870c42

Browse files
committed
SSLSocket: remove class variable InetSocketAddress, can be local to methods which require
1 parent f515a3e commit 0870c42

1 file changed

Lines changed: 12 additions & 9 deletions

File tree

src/java/com/wolfssl/provider/jsse/WolfSSLSocket.java

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ public class WolfSSLSocket extends SSLSocket {
6969

7070
private Socket socket = null;
7171
private boolean autoClose;
72-
private InetSocketAddress address = null;
7372

7473
private WolfSSLInputStream inStream;
7574
private WolfSSLOutputStream outStream;
@@ -1566,6 +1565,8 @@ public void bind(SocketAddress bindpoint) throws IOException {
15661565
synchronized public void connect(SocketAddress endpoint)
15671566
throws IOException {
15681567

1568+
InetSocketAddress address = null;
1569+
15691570
WolfSSLDebug.log(getClass(), WolfSSLDebug.INFO,
15701571
"entered connect(SocketAddress endpoint)");
15711572

@@ -1580,15 +1581,15 @@ synchronized public void connect(SocketAddress endpoint)
15801581
super.connect(endpoint);
15811582
}
15821583

1583-
this.address = (InetSocketAddress)endpoint;
1584+
address = (InetSocketAddress)endpoint;
15841585

15851586
/* register host/port for session resumption in case where
15861587
createSocket() was called without host/port, but
15871588
SSLSocket.connect() was explicitly called with SocketAddress */
1588-
if (this.address != null && EngineHelper != null) {
1589+
if (address != null && EngineHelper != null) {
15891590
EngineHelper.setHostAndPort(
1590-
this.address.getAddress().getHostName(),
1591-
this.address.getPort());
1591+
address.getAddress().getHostName(),
1592+
address.getPort());
15921593
}
15931594

15941595
/* if user is calling after WolfSSLSession creation, register
@@ -1614,6 +1615,8 @@ synchronized public void connect(SocketAddress endpoint)
16141615
synchronized public void connect(SocketAddress endpoint, int timeout)
16151616
throws IOException {
16161617

1618+
InetSocketAddress address = null;
1619+
16171620
WolfSSLDebug.log(getClass(), WolfSSLDebug.INFO,
16181621
"entered connect(SocketAddress endpoint, int timeout)");
16191622

@@ -1628,15 +1631,15 @@ synchronized public void connect(SocketAddress endpoint, int timeout)
16281631
super.connect(endpoint, timeout);
16291632
}
16301633

1631-
this.address = (InetSocketAddress)endpoint;
1634+
address = (InetSocketAddress)endpoint;
16321635

16331636
/* register host/port for session resumption in case where
16341637
createSocket() was called without host/port, but
16351638
SSLSocket.connect() was explicitly called with SocketAddress */
1636-
if (this.address != null && EngineHelper != null) {
1639+
if (address != null && EngineHelper != null) {
16371640
EngineHelper.setHostAndPort(
1638-
this.address.getAddress().getHostName(),
1639-
this.address.getPort());
1641+
address.getAddress().getHostName(),
1642+
address.getPort());
16401643
}
16411644

16421645
/* if user is calling after WolfSSLSession creation, register

0 commit comments

Comments
 (0)