mirror of
https://github.com/square/okhttp.git
synced 2026-01-24 04:02:07 +03:00
Connected after everything is initialized
(cherry picked from commit ed2ee02570)
Conflicts:
okhttp/src/main/java/com/squareup/okhttp/Connection.java
This commit is contained in:
committed by
Jake Wharton
parent
8bd0fe8303
commit
6049ffd43f
@@ -93,10 +93,8 @@ public final class Connection implements Closeable {
|
||||
|
||||
public void connect(int connectTimeout, int readTimeout, TunnelRequest tunnelRequest)
|
||||
throws IOException {
|
||||
if (connected) {
|
||||
throw new IllegalStateException("already connected");
|
||||
}
|
||||
connected = true;
|
||||
if (connected) throw new IllegalStateException("already connected");
|
||||
|
||||
socket = (route.proxy.type() != Proxy.Type.HTTP) ? new Socket(route.proxy) : new Socket();
|
||||
Platform.get().connectSocket(socket, route.inetSocketAddress, connectTimeout);
|
||||
socket.setSoTimeout(readTimeout);
|
||||
@@ -108,6 +106,7 @@ public final class Connection implements Closeable {
|
||||
} else {
|
||||
streamWrapper();
|
||||
}
|
||||
connected = true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user