Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. SSH/SftpChannel Problem?

SSH/SftpChannel Problem?

Scheduled Pinned Locked Moved Solved Qt Creator and other tools
4 Posts 2 Posters 1.3k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    HAILINLU
    wrote on last edited by
    #1

    when I calls the sftpchannel's listDirectory function Twice ,the program just calls one ,what's the problem?

    raven-worxR 1 Reply Last reply
    0
    • H HAILINLU

      when I calls the sftpchannel's listDirectory function Twice ,the program just calls one ,what's the problem?

      raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by raven-worx
      #2

      @HAILINLU
      in order to expect decent help you should be more specific than this...

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      1 Reply Last reply
      0
      • H Offline
        H Offline
        HAILINLU
        wrote on last edited by
        #3

        there are two functions :cd function used to collect the operation Command and list function used to calls the listDirectory function in the sftpchannel class ,but when I exec the cd function twice ,the list just exec one time.when the last Command finished ,I will calls the execCmdList function to continue the operation.
        void ZSftpOperation::execCmdList()
        {
        if(m_commandQueue.isEmpty())
        {
        return;
        }

        Command cmd = m_commandQueue.dequeue();
        
        switch (cmd) {
        case Cd:
            if(m_cdFile.isEmpty())
            {
                return;
            }
            else
            {
                QString remoteDir = m_cdFile.dequeue();
                list(remoteDir);
            }
            break;
        case Download:
            if(m_downloadFile.isEmpty())
            {
                return;
            }
            else
            {
                QPair<QString,QPair<QString,QString> > downMap;
                QPair<QString,QString> downPair;
                QString remoteFileName;
                QString localPath;
                downMap = m_downloadFile.dequeue();
                //m_remoteDir = downMap.first;
                downPair = downMap.second;
                remoteFileName = downPair.first;
                localPath = downPair.second;
                download(remoteFileName,localPath);
            }
            break;
        case Upload:
            if(m_uploadFile.isEmpty())
            {
                return;
            }
            else
            {
                QPair<QString,QPair<QString,QString> > upMap;
                QPair<QString,QString> upPair;
                QString remoteFileName;
                QString localPath;
                upMap = m_uploadFile.dequeue();
                //m_remoteDir = upMap.first;
                upPair = upMap.second;
                localPath = upPair.first;
                remoteFileName = upPair.second;
                upload(localPath,remoteFileName);
            }
            break;
        case Close:
            closeSFTPChannel();
            break;
        default:
            break;
        }
        

        }

        void ZSftpOperation::cd(const QString &remoteDir)
        {
        m_commandQueue.enqueue(Cd);
        m_cdFile.enqueue(remoteDir);
        if(isDone)
        {
        //execCmdList();
        }
        else
        {
        emit done(isDone);
        }
        }

        void ZSftpOperation::list(const QString &remoteDir)
        {
        m_jobType = JobListDir;
        m_currentCmd = Cd;
        m_remoteDir = remoteDir;
        m_jobListDirId = m_channel->listDirectory(m_remoteDir);
        isDone = false;
        emit done(isDone);
        }

        1 Reply Last reply
        0
        • H Offline
          H Offline
          HAILINLU
          wrote on last edited by
          #4

          I have resolved the problem! It's my operation error,I begin another operation before the last operation finished.

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved