You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mina.apache.org by gn...@apache.org on 2009/11/16 20:57:22 UTC
svn commit: r880934 -
/mina/sshd/trunk/sshd-core/src/main/java/org/apache/sshd/client/channel/AbstractClientChannel.java
Author: gnodet
Date: Mon Nov 16 19:57:22 2009
New Revision: 880934
URL: http://svn.apache.org/viewvc?rev=880934&view=rev
Log:
SSHD-59: Possible stack overflow when closing a client channel
Modified:
mina/sshd/trunk/sshd-core/src/main/java/org/apache/sshd/client/channel/AbstractClientChannel.java
Modified: mina/sshd/trunk/sshd-core/src/main/java/org/apache/sshd/client/channel/AbstractClientChannel.java
URL: http://svn.apache.org/viewvc/mina/sshd/trunk/sshd-core/src/main/java/org/apache/sshd/client/channel/AbstractClientChannel.java?rev=880934&r1=880933&r2=880934&view=diff
==============================================================================
--- mina/sshd/trunk/sshd-core/src/main/java/org/apache/sshd/client/channel/AbstractClientChannel.java (original)
+++ mina/sshd/trunk/sshd-core/src/main/java/org/apache/sshd/client/channel/AbstractClientChannel.java Mon Nov 16 19:57:22 2009
@@ -83,21 +83,23 @@
@Override
public CloseFuture close(final boolean immediately) {
synchronized (lock) {
- if (opened) {
- super.close(immediately);
- } else if (openFuture != null) {
- if (immediately) {
- openFuture.setException(new SshException("Channel closed"));
+ if (!closeFuture.isDone()) {
+ if (opened) {
super.close(immediately);
+ } else if (openFuture != null) {
+ if (immediately) {
+ openFuture.setException(new SshException("Channel closed"));
+ super.close(immediately);
+ } else {
+ openFuture.addListener(new SshFutureListener<OpenFuture>() {
+ public void operationComplete(OpenFuture future) {
+ close(immediately);
+ }
+ });
+ }
} else {
- openFuture.addListener(new SshFutureListener<OpenFuture>() {
- public void operationComplete(OpenFuture future) {
- close(immediately);
- }
- });
+ closeFuture.setClosed();
}
- } else {
- closeFuture.setClosed();
}
}
return closeFuture;