File tree Expand file tree Collapse file tree
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/client Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -265,6 +265,10 @@ public ConfigNodeClient(
265265 }
266266
267267 public void connect (TEndPoint endpoint , int timeoutMs ) throws TException {
268+ // Close existing transport before reassigning to prevent connection leaks.
269+ if (transport != null ) {
270+ transport .close ();
271+ }
268272 transport =
269273 commonConfig .isEnableInternalSSL ()
270274 ? DeepCopyRpcTransportFactory .INSTANCE .getTransport (
@@ -327,10 +331,6 @@ private void tryToConnect(int timeoutMs) throws TException {
327331 }
328332 }
329333
330- if (transport != null ) {
331- transport .close ();
332- }
333-
334334 for (int tryHostNum = 0 ; tryHostNum < configNodes .size (); tryHostNum ++) {
335335 cursor = (cursor + 1 ) % configNodes .size ();
336336 TEndPoint tryEndpoint = configNodes .get (cursor );
You can’t perform that action at this time.
0 commit comments