Quellcode durchsuchen

Narrow scopes for some variables.

pull/91/head
Greg Holmes vor 9 Jahren
Ursprung
Commit
4fe86cade6
1 geänderte Dateien mit 7 neuen und 6 gelöschten Zeilen
  1. 7
    6
      irc/src/com/dmdirc/parser/irc/IRCParser.java

+ 7
- 6
irc/src/com/dmdirc/parser/irc/IRCParser.java Datei anzeigen

195
     /** Hashtable storing all information gathered from 005. */
195
     /** Hashtable storing all information gathered from 005. */
196
     public final Map<String, String> h005Info = new HashMap<>();
196
     public final Map<String, String> h005Info = new HashMap<>();
197
     /** difference in ms between our time and the servers time (used for timestampedIRC). */
197
     /** difference in ms between our time and the servers time (used for timestampedIRC). */
198
-    long tsdiff;
198
+    private long tsdiff;
199
     /** Reference to the Processing Manager. */
199
     /** Reference to the Processing Manager. */
200
     private final ProcessingManager myProcessingManager;
200
     private final ProcessingManager myProcessingManager;
201
     /** Should we automatically disconnect on fatal errors?. */
201
     /** Should we automatically disconnect on fatal errors?. */
202
     private boolean disconnectOnFatal = true;
202
     private boolean disconnectOnFatal = true;
203
     /** Current Socket State. */
203
     /** Current Socket State. */
204
     protected SocketState currentSocketState = SocketState.NULL;
204
     protected SocketState currentSocketState = SocketState.NULL;
205
-    /** This is the socket used for reading from/writing to the IRC server. */
206
-    private Socket socket;
207
     /**
205
     /**
208
      * The underlying socket used for reading/writing to the IRC server.
206
      * The underlying socket used for reading/writing to the IRC server.
209
      * For normal sockets this will be the same as {@link #socket} but for SSL
207
      * For normal sockets this will be the same as {@link #socket} but for SSL
727
         currentSocketState = SocketState.OPENING;
725
         currentSocketState = SocketState.OPENING;
728
 
726
 
729
         final URI connectUri = getConnectURI(getURI());
727
         final URI connectUri = getConnectURI(getURI());
730
-        socket = getSocketFactory().createSocket(connectUri.getHost(), connectUri.getPort());
731
 
728
 
732
-        rawSocket = socket;
729
+        rawSocket = getSocketFactory().createSocket(connectUri.getHost(), connectUri.getPort());
733
 
730
 
731
+        final Socket socket;
734
         if (getURI().getScheme().endsWith("s")) {
732
         if (getURI().getScheme().endsWith("s")) {
735
             callDebugInfo(DEBUG_SOCKET, "Server is SSL.");
733
             callDebugInfo(DEBUG_SOCKET, "Server is SSL.");
736
 
734
 
742
             sc.init(myKeyManagers, myTrustManager, new SecureRandom());
740
             sc.init(myKeyManagers, myTrustManager, new SecureRandom());
743
 
741
 
744
             final SSLSocketFactory socketFactory = sc.getSocketFactory();
742
             final SSLSocketFactory socketFactory = sc.getSocketFactory();
745
-            socket = socketFactory.createSocket(socket, getURI().getHost(), getURI().getPort(), false);
743
+            socket = socketFactory.createSocket(rawSocket, getURI().getHost(), getURI()
744
+                    .getPort(), false);
746
 
745
 
747
             // Manually start a handshake so we get proper SSL errors here,
746
             // Manually start a handshake so we get proper SSL errors here,
748
             // and so that we can control the connection timeout
747
             // and so that we can control the connection timeout
752
             socket.setSoTimeout(timeout);
751
             socket.setSoTimeout(timeout);
753
 
752
 
754
             currentSocketState = SocketState.OPENING;
753
             currentSocketState = SocketState.OPENING;
754
+        } else {
755
+            socket = rawSocket;
755
         }
756
         }
756
 
757
 
757
         callDebugInfo(DEBUG_SOCKET, "\t-> Opening socket output stream PrintWriter");
758
         callDebugInfo(DEBUG_SOCKET, "\t-> Opening socket output stream PrintWriter");

Laden…
Abbrechen
Speichern