You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by GitBox <gi...@apache.org> on 2020/07/14 17:12:40 UTC

[GitHub] [mina-sshd] lgoldstein commented on a change in pull request #141: [SSHD-1033]: Fix use DynamicPortForwarding + LocalPortForwarding

lgoldstein commented on a change in pull request #141:
URL: https://github.com/apache/mina-sshd/pull/141#discussion_r454512156



##########
File path: sshd-core/src/main/java/org/apache/sshd/common/forward/DefaultForwardingFilter.java
##########
@@ -964,7 +965,7 @@ protected void invokePortEventListenerSignallerHolders(
 
     @Override
     protected synchronized Closeable getInnerCloseable() {
-        return builder().parallel(toString(), dynamicLocal.values()).close(acceptor).build();
+        return builder().parallel(toString(), dynamicLocal.values()).close(dynamicAcceptor).build();

Review comment:
       Don't we need to close the local acceptor as well ?

##########
File path: sshd-core/src/main/java/org/apache/sshd/common/forward/DefaultForwardingFilter.java
##########
@@ -974,22 +975,36 @@ protected void preClose() {
         super.preClose();
     }
 
+	private IoAcceptor createIoAcceptor(Factory<? extends IoHandler> handlerFactory) {
+		Session session = getSession();
+		FactoryManager manager = Objects.requireNonNull(session.getFactoryManager(), "No factory manager");
+		IoServiceFactory factory = Objects.requireNonNull(manager.getIoServiceFactory(), "No I/O service factory");
+		IoHandler handler = handlerFactory.create();
+		return factory.createAcceptor(handler);
+	}
+
+	private IoAcceptor getLocalIoAcceptor(Factory<? extends IoHandler> handlerFactory) {
+		if (localAcceptor == null) {
+			localAcceptor = createIoAcceptor(handlerFactory);
+		}
+		return localAcceptor;
+	}
+
+	private IoAcceptor getDynamicIoAcceptor(Factory<? extends IoHandler> handlerFactory) {

Review comment:
       Let's make these `protected` in accordance with our policy to enable users to easily override our implementation if they see fit.




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@mina.apache.org
For additional commands, e-mail: dev-help@mina.apache.org