[X2Go-Commits] [x2goclient] 01/02: src/sshmasterconnection.cpp: use ssh_channel_listen_forward () instead of ssh_forward_listen () for newer libssh versions.
git-admin at x2go.org
git-admin at x2go.org
Sat Jan 28 17:10:37 CET 2017
This is an automated email from the git hooks/post-receive script.
x2go pushed a commit to branch feature/libssh-api-upgrade
in repository x2goclient.
commit 138a1ac4f01a2348f9f0ab3b8a7ca6f541b819d9
Author: Mihai Moldovan <ionic at ionic.de>
Date: Sat Jan 28 16:04:28 2017 +0100
src/sshmasterconnection.cpp: use ssh_channel_listen_forward () instead of ssh_forward_listen () for newer libssh versions.
---
debian/changelog | 2 ++
src/sshmasterconnection.cpp | 35 ++++++++++++++++++++++++-----------
2 files changed, 26 insertions(+), 11 deletions(-)
diff --git a/debian/changelog b/debian/changelog
index fad063a..8824554 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -557,6 +557,8 @@ x2goclient (4.1.0.0-0x2go1) UNRELEASED; urgency=medium
time (for instance when running x2goclient --help.)
- src/onmainwindow.cpp: correctly guard the new lines from the previous
commit. Fixes compile issues on Linux and other systems.
+ - src/sshmasterconnection.cpp: use ssh_channel_listen_forward () instead
+ of ssh_forward_listen () for newer libssh versions.
[ Bernard Cafarelli ]
* New upstream version (4.1.0.0):
diff --git a/src/sshmasterconnection.cpp b/src/sshmasterconnection.cpp
index 84e0970..b3f9aa3 100644
--- a/src/sshmasterconnection.cpp
+++ b/src/sshmasterconnection.cpp
@@ -279,22 +279,35 @@ void SshMasterConnection::addReverseTunnelConnections()
if(!reverseTunnelRequest[i].listen)
{
reverseTunnelRequest[i].listen=true;
- int rc=ssh_forward_listen(my_ssh_session, NULL, reverseTunnelRequest[i].forwardPort, NULL);
- if(rc==SSH_OK)
- {
- emit reverseTunnelOk(reverseTunnelRequest[i].creator);
+
+ int rc = SSH_AGAIN;
+
+#if LIBSSH_VERSION_INT >= SSH_VERSION_INT (0, 7, 0)
+ /* Non-blocking mode may return SSH_AGAIN, so try again if neceassary. */
+ while (SSH_AGAIN == rc) {
+ rc = ssh_channel_listen_forward(my_ssh_session, NULL, reverseTunnelRequest[i].forwardPort, NULL);
+#else
+ rc = ssh_forward_listen(my_ssh_session, NULL, reverseTunnelRequest[i].forwardPort, NULL);
+#endif
+
+ if(rc==SSH_OK)
+ {
+ emit reverseTunnelOk(reverseTunnelRequest[i].creator);
#ifdef DEBUG
- x2goDebug<<"Listening for TCP/IP connections on "<<reverseTunnelRequest[i].forwardPort;
+ x2goDebug<<"Listening for TCP/IP connections on "<<reverseTunnelRequest[i].forwardPort;
#endif
- }
- if(rc==SSH_ERROR)
- {
- QString err=ssh_get_error(my_ssh_session);
+ }
+ if(rc==SSH_ERROR)
+ {
+ QString err=ssh_get_error(my_ssh_session);
#ifdef DEBUG
- x2goDebug<<"Forward port "<<reverseTunnelRequest[i].forwardPort<<" failed:"<<err;
+ x2goDebug<<"Forward port "<<reverseTunnelRequest[i].forwardPort<<" failed:"<<err;
#endif
- emit reverseTunnelFailed(reverseTunnelRequest[i].creator, err);
+ emit reverseTunnelFailed(reverseTunnelRequest[i].creator, err);
+ }
+#if LIBSSH_VERSION_INT >= SSH_VERSION_INT (0, 7, 0)
}
+#endif
}
}
reverseTunnelRequestMutex.unlock();
--
Alioth's /srv/git/code.x2go.org/x2goclient.git//..//_hooks_/post-receive-email on /srv/git/code.x2go.org/x2goclient.git
More information about the x2go-commits
mailing list