Copilot commented on code in PR #7458:
URL: https://github.com/apache/ignite-3/pull/7458#discussion_r2715990508


##########
modules/network/src/main/java/org/apache/ignite/internal/network/netty/NettyServer.java:
##########
@@ -225,16 +252,29 @@ public CompletableFuture<Void> stop() {
                 return nullCompletedFuture();
             }
 
-            return serverStartFuture.handle((unused, throwable) -> {
-                synchronized (startStopLock) {
-                    ServerChannel localChannel = channel;
-                    if (localChannel != null) {
-                        localChannel.close();
-                    }
+            return serverStartFuture
+                    .handle((unused, throwable) -> {
+                        synchronized (startStopLock) {
+                            ServerChannel localServerChannel = serverChannel;
+                            if (localServerChannel != null) {
+                                localServerChannel.close();
+                            }
 
-                    return serverCloseFuture == null ? 
CompletableFutures.<Void>nullCompletedFuture() : serverCloseFuture;
-                }
-            }).thenCompose(Function.identity());
+                            return 
requireNonNullElse(serverChannelCloseFuture, 
CompletableFutures.<Void>nullCompletedFuture());
+                        }
+                    })
+                    .thenCompose(Function.identity())
+                    .thenCompose(unused -> {
+                        synchronized (startStopLock) {
+                            List<CompletableFuture<Void>> closeFutures = new 
ArrayList<>();
+
+                            for (Channel acceptedChannel : new 
HashSet<>(acceptedChannels)) {
+                                
closeFutures.add(toCompletableFuture(acceptedChannel.close()));
+                            }
+
+                            return CompletableFutures.allOf(closeFutures);
+                        }
+                    });

Review Comment:
   The new behavior of explicitly closing accepted channels during server stop 
(lines 267-277) lacks test coverage. Consider adding a test that verifies that 
accepted channels are properly closed when the server stops, especially in 
scenarios where channels are actively connected when stop is called.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to