|
@@ -212,6 +212,8 @@ public class IRCParser extends BaseSocketAwareParser implements SecureParser, En
|
212
|
212
|
* wrapped, and should therefore not be used to send or receive data.
|
213
|
213
|
*/
|
214
|
214
|
private Socket rawSocket;
|
|
215
|
+ /** The socket connected to the IRC server, used for sending or receiving data. */
|
|
216
|
+ private Socket socket;
|
215
|
217
|
/** Used for writing to the server. */
|
216
|
218
|
private OutputQueue out;
|
217
|
219
|
/** The encoder to use to encode incoming lines. */
|
|
@@ -309,9 +311,10 @@ public class IRCParser extends BaseSocketAwareParser implements SecureParser, En
|
309
|
311
|
*
|
310
|
312
|
* @param queue The queue to be added.
|
311
|
313
|
*/
|
312
|
|
- public void setOutputQueue(final OutputQueue queue) {
|
|
314
|
+ public void setOutputQueue(final OutputQueue queue) throws IOException {
|
313
|
315
|
checkNotNull(queue);
|
314
|
316
|
out.clearQueue();
|
|
317
|
+ queue.setOutputStream(socket.getOutputStream());
|
315
|
318
|
out = queue;
|
316
|
319
|
}
|
317
|
320
|
|
|
@@ -750,7 +753,6 @@ public class IRCParser extends BaseSocketAwareParser implements SecureParser, En
|
750
|
753
|
|
751
|
754
|
rawSocket = getSocketFactory().createSocket(connectUri.getHost(), connectUri.getPort());
|
752
|
755
|
|
753
|
|
- final Socket mySocket;
|
754
|
756
|
if (getURI().getScheme().endsWith("s")) {
|
755
|
757
|
callDebugInfo(DEBUG_SOCKET, "Server is SSL.");
|
756
|
758
|
|
|
@@ -762,27 +764,27 @@ public class IRCParser extends BaseSocketAwareParser implements SecureParser, En
|
762
|
764
|
sc.init(myKeyManagers, myTrustManager, new SecureRandom());
|
763
|
765
|
|
764
|
766
|
final SSLSocketFactory socketFactory = sc.getSocketFactory();
|
765
|
|
- mySocket = socketFactory.createSocket(rawSocket, getURI().getHost(), getURI()
|
|
767
|
+ socket = socketFactory.createSocket(rawSocket, getURI().getHost(), getURI()
|
766
|
768
|
.getPort(), false);
|
767
|
769
|
|
768
|
770
|
// Manually start a handshake so we get proper SSL errors here,
|
769
|
771
|
// and so that we can control the connection timeout
|
770
|
|
- final int timeout = mySocket.getSoTimeout();
|
771
|
|
- mySocket.setSoTimeout(10000);
|
772
|
|
- ((SSLSocket) mySocket).startHandshake();
|
773
|
|
- mySocket.setSoTimeout(timeout);
|
|
772
|
+ final int timeout = socket.getSoTimeout();
|
|
773
|
+ socket.setSoTimeout(10000);
|
|
774
|
+ ((SSLSocket) socket).startHandshake();
|
|
775
|
+ socket.setSoTimeout(timeout);
|
774
|
776
|
|
775
|
777
|
currentSocketState = SocketState.OPENING;
|
776
|
778
|
} else {
|
777
|
|
- mySocket = rawSocket;
|
|
779
|
+ socket = rawSocket;
|
778
|
780
|
}
|
779
|
781
|
|
780
|
782
|
callDebugInfo(DEBUG_SOCKET, "\t-> Opening socket output stream PrintWriter");
|
781
|
|
- out.setOutputStream(mySocket.getOutputStream());
|
|
783
|
+ out.setOutputStream(socket.getOutputStream());
|
782
|
784
|
out.setQueueEnabled(true);
|
783
|
785
|
currentSocketState = SocketState.OPEN;
|
784
|
786
|
callDebugInfo(DEBUG_SOCKET, "\t-> Opening socket input stream BufferedReader");
|
785
|
|
- in = new IRCReader(mySocket.getInputStream(), encoder);
|
|
787
|
+ in = new IRCReader(socket.getInputStream(), encoder);
|
786
|
788
|
callDebugInfo(DEBUG_SOCKET, "\t-> Socket Opened");
|
787
|
789
|
}
|
788
|
790
|
|