From c633f110532587e1568e93735688d926bce99cb7 Mon Sep 17 00:00:00 2001
From: Melroy van den Berg <melroy@melroy.org>
Date: Tue, 19 May 2020 22:40:06 +0200
Subject: [PATCH 02/11] endl for every debug line..

---
 src/sshmasterconnection.cpp | 140 ++++++++++++++++++------------------
 1 file changed, 68 insertions(+), 72 deletions(-)

diff --git a/src/sshmasterconnection.cpp b/src/sshmasterconnection.cpp
index 424cad2..f598e9c 100644
--- a/src/sshmasterconnection.cpp
+++ b/src/sshmasterconnection.cpp
@@ -161,7 +161,7 @@ SshMasterConnection::SshMasterConnection(QObject *parent, QString host, int port
     kerberosDelegation = false;
     x2goDebug << "SshMasterConnection, host " << host << "; port " << port << "; user " << user
               << "; useproxy " << useproxy << "; proxyserver " << proxyserver
-              << "; proxyport " << proxyport;
+              << "; proxyport " << proxyport << endl;
     this->host = host;
     // If the hostname starts with "!" do not perform loginCheck() for this connection
     if (this->host.indexOf("!") == 0)
@@ -202,7 +202,7 @@ SshMasterConnection::SshMasterConnection(QObject *parent, QString host, int port
         {
             QString error_msg = tr("Cannot create SSH session.");
             error_msg += " " + tr("Using environment-provided username.");
-            x2goDebug << error_msg;
+            x2goDebug << error_msg << endl;
         }
         else
         {
@@ -214,12 +214,12 @@ SshMasterConnection::SshMasterConnection(QObject *parent, QString host, int port
 
             if (ssh_options_parse_config(tmp_session, NULL) < 0)
             {
-                x2goDebug << "Warning: unable to parse the SSH config file.";
+                x2goDebug << "Warning: unable to parse the SSH config file." << endl;
             }
 
             char *inferred_username = NULL;
             ssh_options_get(tmp_session, SSH_OPTIONS_USER, &inferred_username);
-            x2goDebug << "Temporary session user name after config file parse: " << inferred_username;
+            x2goDebug << "Temporary session user name after config file parse: " << inferred_username << endl;
 
             this->user = QString::fromLocal8Bit(inferred_username);
 
@@ -240,18 +240,18 @@ SshMasterConnection::SshMasterConnection(QObject *parent, QString host, int port
 
     if (kerberos)
     {
-        x2goDebug << "Starting SSH connection with Kerberos authentication.";
+        x2goDebug << "Starting SSH connection with Kerberos authentication." << endl;
     }
     else
     {
-        x2goDebug << "Starting SSH connection without Kerberos authentication.";
+        x2goDebug << "Starting SSH connection without Kerberos authentication." << endl;
     }
-    x2goDebug << "SshMasterConnection, instance " << this << " created.";
+    x2goDebug << "SshMasterConnection, instance " << this << " created." << endl;
 }
 
 void SshMasterConnection::slotSshProxyConnectionOk()
 {
-    x2goDebug << "SSH proxy connected.";
+    x2goDebug << "SSH proxy connected." << endl;
 
     localProxyPort = PROXYTUNNELPORT;
     while (ONMainWindow::isServerRunning(localProxyPort))
@@ -319,12 +319,12 @@ void SshMasterConnection::addReverseTunnelConnections()
                 if (rc == SSH_OK)
                 {
                     emit reverseTunnelOk(reverseTunnelRequest[i].creator);
-                    x2goDebug << "Listening for TCP/IP connections on " << reverseTunnelRequest[i].forwardPort;
+                    x2goDebug << "Listening for TCP/IP connections on " << reverseTunnelRequest[i].forwardPort << endl;
                 }
                 if (rc == SSH_ERROR)
                 {
                     QString err = ssh_get_error(my_ssh_session);
-                    x2goDebug << "Forward port " << reverseTunnelRequest[i].forwardPort << " failed:" << err;
+                    x2goDebug << "Forward port " << reverseTunnelRequest[i].forwardPort << " failed:" << err << endl;
                     emit reverseTunnelFailed(reverseTunnelRequest[i].creator, err);
                 }
             }
@@ -339,7 +339,7 @@ void SshMasterConnection::checkReverseTunnelConnections()
     ssh_channel chan = ssh_channel_accept_forward(my_ssh_session, 0, &port);
     if (chan)
     {
-        x2goDebug << "New reverse connection on port " << port;
+        x2goDebug << "New reverse connection on port " << port << endl;
 
         reverseTunnelRequestMutex.lock();
         for (int i = 0; i < reverseTunnelRequest.count(); ++i)
@@ -347,7 +347,7 @@ void SshMasterConnection::checkReverseTunnelConnections()
             ReverseTunnelRequest req = reverseTunnelRequest[i];
             if (static_cast<int>(req.forwardPort) == port)
             {
-                x2goDebug << "Creating new channel for reverse tunnel " << port;
+                x2goDebug << "Creating new channel for reverse tunnel " << port << endl;
                 int sock = socket(AF_INET, SOCK_STREAM, 0);
 #ifndef Q_OS_WIN
                 const int y = 1;
@@ -383,7 +383,7 @@ void SshMasterConnection::checkReverseTunnelConnections()
                 channelConnectionsMutex.lock();
                 channelConnections << con;
                 channelConnectionsMutex.unlock();
-                x2goDebug << "New channel created";
+                x2goDebug << "New channel created" << endl;
                 break;
             }
         }
@@ -414,7 +414,7 @@ int SshMasterConnection::startTunnel(const QString &forwardHost, uint forwardPor
         req.localHost = localHost;
         req.forwardPort = forwardPort;
         req.listen = false;
-        x2goDebug << "Requesting reverse tunnel from port " << forwardPort << " to " << localPort;
+        x2goDebug << "Requesting reverse tunnel from port " << forwardPort << " to " << localPort << endl;
         reverseTunnelRequestMutex.lock();
         reverseTunnelRequest << req;
         reverseTunnelRequestMutex.unlock();
@@ -425,7 +425,7 @@ int SshMasterConnection::startTunnel(const QString &forwardHost, uint forwardPor
 
 void SshMasterConnection::slotSshProxyInteractionFinish(SshMasterConnection *connection)
 {
-    x2goDebug << "SSH proxy interaction finished";
+    x2goDebug << "SSH proxy interaction finished" << endl;
     slotSshProxyUserAuthError("NO_ERROR");
 }
 
@@ -461,7 +461,7 @@ void SshMasterConnection::slotSshProxyUserAuthError(QString err)
 
 void SshMasterConnection::slotSshProxyTunnelOk(int)
 {
-    x2goDebug << "SSH proxy tunnel established.";
+    x2goDebug << "SSH proxy tunnel established." << endl;
     sshProxyReady = true;
 }
 
@@ -479,10 +479,10 @@ void SshMasterConnection::slotSshProxyServerAuthAborted()
 
 void SshMasterConnection::run()
 {
-    x2goDebug << "SshMasterConnection, instance " << this << " entering thread.";
+    x2goDebug << "SshMasterConnection, instance " << this << " entering thread." << endl;
     if (useproxy && proxytype == PROXYSSH)
     {
-        x2goDebug << "proxyserver: " << proxyserver << "; proxyport: " << proxyport << "; proxylogin: " << proxylogin;
+        x2goDebug << "proxyserver: " << proxyserver << "; proxyport: " << proxyport << "; proxylogin: " << proxylogin << endl;
         sshProxy = new SshMasterConnection(0, proxyserver, proxyport, acceptUnknownServers,
                                            proxylogin, proxypassword, proxykey, proxyautologin, proxyKrbLogin, false);
 
@@ -608,7 +608,7 @@ void SshMasterConnection::run()
         }
         QString err = ssh_get_error(my_ssh_session);
         QString message = tr("Cannot connect to ") + host + ":" + QString::number(port);
-        x2goDebug << message << " - " << err;
+        x2goDebug << message << " - " << err << endl;
         emit connectionError(message, err);
         ssh_free(my_ssh_session);
         quit();
@@ -673,7 +673,7 @@ void SshMasterConnection::run()
             x2goDebug << "Session is already disconnected, exiting." << endl;
             return;
         }
-        x2goDebug << "User authentication OK.";
+        x2goDebug << "User authentication OK." << endl;
         // checkLogin() is currently specific to libssh.
         if (kerberos)
         {
@@ -681,19 +681,19 @@ void SshMasterConnection::run()
         }
         else if (this->loginCheck == false)
         {
-            x2goDebug << "Skipping Login Check as requested by configuration";
+            x2goDebug << "Skipping Login Check as requested by configuration" << endl;
             emit connectionOk(host);
         }
         else
         {
             if (checkLogin())
             {
-                x2goDebug << "Login Check - OK";
+                x2goDebug << "Login Check - OK" << endl;
                 emit connectionOk(host);
             }
             else
             {
-                x2goDebug << "Login Check - Failed";
+                x2goDebug << "Login Check - Failed" << endl;
                 //          if(!interactionInterrupt)
                 {
                     emit finishInteraction(this);
@@ -722,7 +722,7 @@ void SshMasterConnection::run()
             err = sshProcErrString;
         }
         QString message = tr("Authentication failed.");
-        x2goDebug << message << " - " << err;
+        x2goDebug << message << " - " << err << endl;
         emit userAuthError(authErrors.join("\n"));
         ssh_disconnect(my_ssh_session);
         ssh_free(my_ssh_session);
@@ -747,14 +747,14 @@ SshMasterConnection::~SshMasterConnection()
     disconnectFlagMutex.lock();
     disconnectSessionFlag = true;
     disconnectFlagMutex.unlock();
-    x2goDebug << "SshMasterConnection, instance " << this << " waiting for thread to finish.";
+    x2goDebug << "SshMasterConnection, instance " << this << " waiting for thread to finish." << endl;
     wait(15000);
-    x2goDebug << "SshMasterConnection, instance " << this << " thread finished.";
+    x2goDebug << "SshMasterConnection, instance " << this << " thread finished." << endl;
     for (int i = processes.count() - 1; i >= 0; --i)
     {
         delete processes[i];
     }
-    x2goDebug << "SshMasterConnection, instance " << this << " finished destructor.";
+    x2goDebug << "SshMasterConnection, instance " << this << " finished destructor." << endl;
 }
 
 bool SshMasterConnection::sshConnect()
@@ -781,7 +781,7 @@ bool SshMasterConnection::sshConnect()
 #if LIBSSH_VERSION_INT >= SSH_VERSION_INT(0, 6, 0)
     unsigned int cur_port = 0;
     ssh_options_get_port(my_ssh_session, &cur_port);
-    x2goDebug << "Session port before config file parse: " << cur_port;
+    x2goDebug << "Session port before config file parse: " << cur_port << endl;
 #endif
 
     /* Parse ~/.ssh/config. */
@@ -792,7 +792,7 @@ bool SshMasterConnection::sshConnect()
 
 #if LIBSSH_VERSION_INT >= SSH_VERSION_INT(0, 6, 0)
     ssh_options_get_port(my_ssh_session, &cur_port);
-    x2goDebug << "Session port after config file parse: " << cur_port;
+    x2goDebug << "Session port after config file parse: " << cur_port << endl;
 #endif
 
     rc = ssh_connect(my_ssh_session);
@@ -803,7 +803,7 @@ bool SshMasterConnection::sshConnect()
     //set values for remote host for proper server authentication
     if (useproxy && proxytype == PROXYSSH)
     {
-        x2goDebug << "Connected via proxy, resetting connection values on session to " << tmpBA.data() << ":" << port;
+        x2goDebug << "Connected via proxy, resetting connection values on session to " << tmpBA.data() << ":" << port << endl;
         ssh_options_set(my_ssh_session, SSH_OPTIONS_HOST, tmpBA.data());
 
         /*
@@ -830,7 +830,7 @@ bool SshMasterConnection::sshConnect()
             if (!tmp_session)
             {
                 QString error_msg = tr("Cannot create SSH session.");
-                x2goDebug << error_msg;
+                x2goDebug << error_msg << endl;
                 return (false);
             }
             else
@@ -840,12 +840,12 @@ bool SshMasterConnection::sshConnect()
                 /* Parse ~/.ssh/config. */
                 if (ssh_options_parse_config(tmp_session, NULL) < 0)
                 {
-                    x2goDebug << "Warning: unable to parse the SSH config file.";
+                    x2goDebug << "Warning: unable to parse the SSH config file." << endl;
                 }
 
                 unsigned int inferred_port = 0;
                 ssh_options_get_port(tmp_session, &inferred_port);
-                x2goDebug << "Fetched inferred session port: " << inferred_port;
+                x2goDebug << "Fetched inferred session port: " << inferred_port << endl;
 
                 work_port = inferred_port & 0xFFFF;
 
@@ -859,7 +859,7 @@ bool SshMasterConnection::sshConnect()
 
 #if LIBSSH_VERSION_INT >= SSH_VERSION_INT(0, 6, 0)
     ssh_options_get_port(my_ssh_session, &cur_port);
-    x2goDebug << "Session port before config file parse (part 2): " << cur_port;
+    x2goDebug << "Session port before config file parse (part 2): " << cur_port << endl;
 #endif
 
     /* Parse ~/.ssh/config. */
@@ -870,7 +870,7 @@ bool SshMasterConnection::sshConnect()
 
 #if LIBSSH_VERSION_INT >= SSH_VERSION_INT(0, 6, 0)
     ssh_options_get_port(my_ssh_session, &cur_port);
-    x2goDebug << "Session port after config file parse (part 2): " << cur_port;
+    x2goDebug << "Session port after config file parse (part 2): " << cur_port << endl;
 #endif
 
     return true;
@@ -891,7 +891,7 @@ void SshMasterConnection::writeKnownHosts(bool write)
 
 int SshMasterConnection::serverAuth(QString &errorMsg)
 {
-    x2goDebug << "cserverAuth";
+    x2goDebug << "cserverAuth" << endl;
 
     int state = SSH_SERVER_ERROR;
     unsigned char *hash = NULL;
@@ -974,7 +974,7 @@ void SshMasterConnection::setVerficationCode(QString code)
 
 bool SshMasterConnection::userAuthKeyboardInteractive(QString prompt)
 {
-    x2goDebug << "Open Interaction dialog to complete authentication";
+    x2goDebug << "Open Interaction dialog to complete authentication" << endl;
     emit startInteraction(this, prompt);
     interactionInterrupt = false;
     interactionInputText = QString::null;
@@ -1013,14 +1013,14 @@ bool SshMasterConnection::userAuthKeyboardInteractive(QString prompt)
                 interactionInputMutex.unlock();
                 if (textToSend.length() > 0)
                 {
-                    x2goDebug << "SEND Input to SERVER";
+                    x2goDebug << "SEND Input to SERVER" << endl;
                     textToSend.replace("\n", "");
                     ssh_userauth_kbdint_setanswer(my_ssh_session, 0, textToSend.toLocal8Bit());
                     break;
                 }
                 if (interrupt)
                 {
-                    x2goDebug << "Keyboard authentication failed";
+                    x2goDebug << "Keyboard authentication failed" << endl;
                     //         QString err=ssh_get_error ( my_ssh_session );
                     authErrors << "NO_ERROR";
                     emit finishInteraction(this);
@@ -1035,13 +1035,13 @@ bool SshMasterConnection::userAuthKeyboardInteractive(QString prompt)
     }
     if (rez == SSH_AUTH_SUCCESS)
     {
-        x2goDebug << "Keyboard authentication successful";
+        x2goDebug << "Keyboard authentication successful" << endl;
         emit finishInteraction(this);
         return true;
     }
     if (rez == SSH_AUTH_DENIED)
     {
-        x2goDebug << "Keyboard authentication failed";
+        x2goDebug << "Keyboard authentication failed" << endl;
         QString err = ssh_get_error(my_ssh_session);
         if (instruction.length() > 0)
         {
@@ -1324,7 +1324,7 @@ void SshMasterConnection::setKeyPhrase(QString phrase)
 
 bool SshMasterConnection::userAuthWithKey()
 {
-    x2goDebug << "Trying to authenticate user with private key.";
+    x2goDebug << "Trying to authenticate user with private key." << endl;
     QString keyName = key;
     bool autoRemove = false;
     if (key.indexOf("PRIVATE KEY") != -1)
@@ -1340,7 +1340,7 @@ bool SshMasterConnection::userAuthWithKey()
         out << key;
         fl.close();
         autoRemove = true;
-        x2goDebug << "Temporarily saved key in " << keyName;
+        x2goDebug << "Temporarily saved key in " << keyName << endl;
     }
 
     QByteArray tmp_ba = keyName.toLocal8Bit();
@@ -1363,7 +1363,7 @@ bool SshMasterConnection::userAuthWithKey()
 
     if (SSH_EOF == rc)
     {
-        x2goDebug << "Failed to get private key from " << keyName << "; file does not exist.";
+        x2goDebug << "Failed to get private key from " << keyName << "; file does not exist." << endl;
 
         ssh_key_free(priv_key);
 
@@ -1371,7 +1371,7 @@ bool SshMasterConnection::userAuthWithKey()
     }
     else if (SSH_OK != rc)
     {
-        x2goDebug << "Failed to get private key from " << keyName << "; trying to query passphrase.";
+        x2goDebug << "Failed to get private key from " << keyName << "; trying to query passphrase." << endl;
 
         ssh_key_free(priv_key);
         priv_key = NULL;
@@ -1441,7 +1441,7 @@ bool SshMasterConnection::userAuthWithKey()
     if (!priv_key)
 #endif
     {
-        x2goDebug << "Failed to get private key from " << keyName;
+        x2goDebug << "Failed to get private key from " << keyName << endl;
         if (autoRemove)
             QFile::remove(keyName);
         return false;
@@ -1461,7 +1461,7 @@ bool SshMasterConnection::userAuthWithKey()
     if (!pub_key)
 #endif
     {
-        x2goDebug << "Failed to get public key from private key.";
+        x2goDebug << "Failed to get public key from private key." << endl;
 #if LIBSSH_VERSION_INT >= SSH_VERSION_INT(0, 6, 0)
         ssh_key_free(priv_key);
         priv_key = NULL;
@@ -1488,7 +1488,7 @@ bool SshMasterConnection::userAuthWithKey()
     /* FIXME: handle SSH_AUTH_PARTIAL correctly! */
     if (SSH_AUTH_SUCCESS != rc)
     {
-        x2goDebug << "Unable to authenticate with public key.";
+        x2goDebug << "Unable to authenticate with public key." << endl;
 
         ssh_key_free(priv_key);
         priv_key = NULL;
@@ -1612,7 +1612,7 @@ bool SshMasterConnection::userAuthKrb()
     }
     QString outp = ssh.readAllStandardOutput();
     QString err = ssh.readAllStandardError();
-    x2goDebug << "SSH exited.";
+    x2goDebug << "SSH exited." << endl;
     x2goDebug << "stdout: " << outp << endl;
     x2goDebug << "stderr: " << err << endl;
     x2goDebug << "Exit code: " << ssh.exitCode() << "; status: " << ssh.exitStatus() << endl;
@@ -1705,7 +1705,6 @@ bool SshMasterConnection::checkLogin()
         char buffer[1024 * 512]; //512K buffer
         bool hasInterraction = true;
         bool interactionStarted = false;
-        //         x2goDebug<<"CHECK LOGIN channel created."<<endl;
         while (ssh_channel_is_open(channel) &&
                !ssh_channel_is_eof(channel))
         {
@@ -1718,10 +1717,10 @@ bool SshMasterConnection::checkLogin()
             if (nbytes > 0)
             {
                 QString inf = QByteArray(buffer, nbytes);
-                x2goDebug << "LOGIN CHECK:" << inf;
+                x2goDebug << "LOGIN CHECK:" << inf << endl;
                 if (inf.indexOf("LOGIN OK") != -1)
                 {
-                    x2goDebug << "don't have interaction";
+                    x2goDebug << "don't have interaction" << endl;
                     hasInterraction = false;
                     break;
                 }
@@ -1744,7 +1743,6 @@ bool SshMasterConnection::checkLogin()
             interactionInputMutex.unlock();
             if (textToSend.length() > 0)
             {
-                // 	        x2goDebug<<"SEND Input to SERVER";
                 ssh_channel_write(channel, textToSend.toLocal8Bit().constData(), textToSend.length());
             }
             if (interrupt)
@@ -1754,17 +1752,17 @@ bool SshMasterConnection::checkLogin()
             this->usleep(30);
         }
 
-        x2goDebug << "LOOP FINISHED";
+        x2goDebug << "LOOP FINISHED" << endl;
         bool retVal = false;
         if (!hasInterraction)
         {
-            x2goDebug << "No interaction needed, continue session";
+            x2goDebug << "No interaction needed, continue session" << endl;
             retVal = true;
         }
         else
         {
             sshProcErrString = tr("Reconnect session");
-            x2goDebug << "Reconnect session";
+            x2goDebug << "Reconnect session" << endl;
         }
         ssh_channel_close(channel);
         ssh_channel_send_eof(channel);
@@ -1816,11 +1814,11 @@ void SshMasterConnection::addChannelConnection(SshProcess *creator, QString uuid
     con.command = cmd;
     con.uuid = uuid;
 
-    x2goDebug << "Locking SSH channel connection MUTEX.";
+    x2goDebug << "Locking SSH channel connection MUTEX." << endl;
     channelConnectionsMutex.lock();
-    x2goDebug << "Passing new channel connection object to channelConnections.";
+    x2goDebug << "Passing new channel connection object to channelConnections." << endl;
     channelConnections << con;
-    x2goDebug << "Unlocking SSH channel connection MUTEX.";
+    x2goDebug << "Unlocking SSH channel connection MUTEX." << endl;
     channelConnectionsMutex.unlock();
 }
 
@@ -1962,7 +1960,7 @@ void SshMasterConnection::channelLoop()
         channelConnectionsMutex.lock();
         if (channelConnections.size() <= 0)
         {
-            //             x2goDebug<<"no channel connections, waiting\n";
+            // x2goDebug<<"no channel connections, waiting\n";
             channelConnectionsMutex.unlock();
             usleep(500);
             continue;
@@ -2001,7 +1999,7 @@ void SshMasterConnection::channelLoop()
                     x2goDebug << "Forwarding parameters: from remote (" << channelConnections.at(i).forwardHost << ":"
                               << channelConnections.at(i).forwardPort << ") to local ("
                               << channelConnections.at(i).localHost << ":" << channelConnections.at(i).localPort
-                              << ")";
+                              << ")" << endl;
 
                     /*
                      * Cannot support config file parsing here with pre-0.6.0 libssh versions.
@@ -2013,7 +2011,7 @@ void SshMasterConnection::channelLoop()
                     if (!tmp_session)
                     {
                         QString error_msg = tr("Cannot create SSH session.");
-                        x2goDebug << error_msg;
+                        x2goDebug << error_msg << endl;
                         emit ioErr(channelConnections[i].creator, error_msg, "");
                     }
                     else
@@ -2031,16 +2029,16 @@ void SshMasterConnection::channelLoop()
                         /* The host and port might be a shorthand and zero, so fetch the actual data. */
                         if (ssh_options_parse_config(tmp_session, NULL) < 0)
                         {
-                            x2goDebug << "Warning: unable to parse the SSH config file.";
+                            x2goDebug << "Warning: unable to parse the SSH config file." << endl;
                         }
 
                         unsigned int inferred_port = 0;
                         ssh_options_get_port(tmp_session, &inferred_port);
-                        x2goDebug << "Temporary session port after config file parse: " << inferred_port;
+                        x2goDebug << "Temporary session port after config file parse: " << inferred_port << endl;
 
                         char *inferred_host = NULL;
                         ssh_options_get(tmp_session, SSH_OPTIONS_HOST, &inferred_host);
-                        x2goDebug << "Temporary session host after config file parse: " << inferred_host;
+                        x2goDebug << "Temporary session host after config file parse: " << inferred_host << endl;
 
                         channelConnections[i].forwardHost = QString(inferred_host);
                         channelConnections[i].forwardPort = static_cast<int>(inferred_port);
@@ -2105,12 +2103,10 @@ void SshMasterConnection::channelLoop()
 
         if (retval == -1)
         {
-            x2goDebug << "select() error.";
+            x2goDebug << "select() error." << endl;
             continue;
         }
 
-        //         x2goDebug<<"select exited"<<endl;
-
         channelConnectionsMutex.lock();
         for (int i = channelConnections.size() - 1; i >= 0; --i)
         {
@@ -2128,7 +2124,7 @@ void SshMasterConnection::channelLoop()
             int rez = ssh_channel_poll(channel, 0);
             if (rez == SSH_EOF)
             {
-                x2goDebug << "EOF on channel " << channel << "; SshProcess object: " << channelConnections[i].creator->pid;
+                x2goDebug << "EOF on channel " << channel << "; SshProcess object: " << channelConnections[i].creator->pid << endl;
 
                 //////Finished////////
                 finalize(i);
@@ -2172,7 +2168,7 @@ void SshMasterConnection::channelLoop()
 
                 if (ssh_channel_is_eof(channel))
                 {
-                    x2goDebug << "EOF on channel " << channel << "; SshProcess object: " << channelConnections[i].creator->pid;
+                    x2goDebug << "EOF on channel " << channel << "; SshProcess object: " << channelConnections[i].creator->pid << endl;
 
                     //////Finished////////
                     finalize(i);
@@ -2229,9 +2225,9 @@ void SshMasterConnection::finalize(int item)
     if (channel)
     {
         ssh_channel_send_eof(channel);
-        x2goDebug << "EOF sent.";
+        x2goDebug << "EOF sent." << endl;
         ssh_channel_close(channel);
-        x2goDebug << "Channel closed.";
+        x2goDebug << "Channel closed." << endl;
         ssh_channel_free(channel);
     }
     if (tcpSocket > 0)
-- 
2.17.1

