Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[misc] permit using SSL on localsocket
  • Loading branch information
rusher committed Mar 13, 2019
1 parent a1f2d5f commit d44da9b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Expand Up @@ -85,6 +85,7 @@ public class UnixDomainSocket extends Socket {
private final int fd;
private InputStream is;
private OutputStream os;
private boolean connected;

public UnixDomainSocket(String path) throws IOException {
if (Platform.isWindows() || Platform.isWindowsCE()) {
Expand All @@ -99,6 +100,11 @@ public UnixDomainSocket(String path) throws IOException {
}
}

@Override
public boolean isConnected() {
return connected;
}

public static native int socket(int domain, int type, int protocol) throws LastErrorException;

public static native int connect(int sockfd, SockAddr sockaddr, int addrlen)
Expand Down Expand Up @@ -130,6 +136,7 @@ public void close() throws IOException {
} catch (LastErrorException lee) {
throw new IOException("native close() failed : " + formatError(lee));
}
connected = false;
}
}

Expand All @@ -144,6 +151,7 @@ public void connect(SocketAddress endpoint, int timeout) throws IOException {
if (ret != 0) {
throw new IOException(strerror(Native.getLastError()));
}
connected = true;
} catch (LastErrorException lee) {
throw new IOException("native connect() failed : " + formatError(lee));
}
Expand Down
Expand Up @@ -706,7 +706,7 @@ private void handleConnectionPhases(String host) throws SQLException {

SSLSocketFactory sslSocketFactory = SslFactory.getSslSocketFactory(options);
SSLSocket sslSocket = (SSLSocket) sslSocketFactory.createSocket(socket,
socket.getInetAddress().getHostAddress(), socket.getPort(), true);
socket.getInetAddress() == null ? null : socket.getInetAddress().getHostAddress(), socket.getPort(), true);

enabledSslProtocolSuites(sslSocket);
enabledSslCipherSuites(sslSocket);
Expand Down

0 comments on commit d44da9b

Please sign in to comment.