Skip to content

Commit 47a0fc3

Browse files
fix: only keep track of sockets opened using domain name
1 parent a5329ac commit 47a0fc3

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

core/src/main/java/com/google/cloud/sql/core/Connector.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,11 @@ Socket connect(ConnectionConfig config, long timeoutMs) throws IOException {
138138
}
139139

140140
logger.debug(String.format("[%s] Connected to instance successfully.", instanceIp));
141-
instance.addSocket(socket);
141+
// If this connection was opened using a domain name, then store it
142+
// for later in case we need to forcibly close it on failover.
143+
if (!Strings.isNullOrEmpty(config.getDomainName())) {
144+
instance.addSocket(socket);
145+
}
142146

143147
return socket;
144148
} catch (IOException e) {

0 commit comments

Comments
 (0)