LibJingle pcp_main.cc 503错误

时间:2012-06-26 00:07:09

标签: c++ libjingle

我一直在尝试让PCP LibJingle示例工作几天。在解决了所有编译和运行错误后,我现在遇到了一个我以前没有遇到过的错误。

当作为发送方或接收方运行程序时,程序会收到503“服务不可用”错误并终止程序,但运行时服务器工作正常。我知道标准是5xx意味着服务器端错误,所以我逐行查看程序输出(在末尾提供)。从我对服务器和LibJingle的近零经验来看,我能想到的最好的是以下任何一个(或两个)都会导致503:

  1. Google已禁用LibJingle pcp示例所需的服务。
  2. 优先级状态= -1(根据我的意图,表示客户端不可用)。
  3. 我已登录两个Google帐户,因此他们不会离线/不可用,而且LibJingle程序会反映这一点。但是,只要PCP示例运行,优先级就会设置回-1。我还注意到,程序输出中的大多数(如果不是全部)Google链接都是404。

    我的问题:

    • 这些理论是否接近可能/正在发生的事情?
    • 我需要做些什么来解决这个问题?
    • 我听说可以使用服务器(Google的服务器除外)来运行该程序。这是真的?如果是这样,我会在哪里研究这个?

    提前感谢您的帮助。 --KMC

    P.S。在提供的程序输出中,我试图从forge ... 1@gmail.com发送文件到forge ... 2@gmail.com。我审查了一些事情并试图减少其他比特。但是,不确定哪些可能相关或不相关,我没有做太多切割。如果某个mod或其他人知道可能相关的内容并希望对其进行编辑,请随意这样做。

    forgefour@forgefour-ubuntu:~/Desktop$ ./LibJingle_Install/libjingle-0.6.13/talk/build/dbg/staging/pcp forge..1@gmail.com call_main.pdf forge..2@gmail.com/pcp8B13E6B8:outputmainadobe.pdf
    Directory: /home/forgefour/Desktop
    Password: 
    connecting...
    [002:406] OpenSSLAdapter::OnConnectEvent
    [002:406] SEND >>>>>>>>>>>>>>>>>>>>>>>>> : Mon Jun 25 17:09:17 2012
    [002:406]    <stream:stream to="gmail.com" xml:lang="*" version="1.0" xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client">
    logging in...
    [002:446] RECV <<<<<<<<<<<<<<<<<<<<<<<<< : Mon Jun 25 17:09:17 2012
    [002:446]    <stream:stream from="gmail.com" id="00B7404A40B94AA0" version="1.0" xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client">
    [002:447] RECV <<<<<<<<<<<<<<<<<<<<<<<<< : Mon Jun 25 17:09:17 2012
    [002:447]    <stream:features>
    [002:447]      <starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls">
    [002:447]        <required/>
    [002:447]      </starttls>
    [002:447]      <mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl">
    [002:447]        <mechanism>
    [002:447]          X-GOOGLE-TOKEN
    [002:447]        </mechanism>
    [002:447]        <mechanism>
    [002:447]          X-OAUTH2
    [002:447]        </mechanism>
    [002:447]      </mechanisms>
    [002:447]    </stream:features>
    [002:447] SEND >>>>>>>>>>>>>>>>>>>>>>>>> : Mon Jun 25 17:09:17 2012
    [002:447]    <starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls"/>
    [002:488] RECV <<<<<<<<<<<<<<<<<<<<<<<<< : Mon Jun 25 17:09:17 2012
    [002:488]    <proceed xmlns="urn:ietf:params:xml:ns:xmpp-tls"/>
    [002:488] BeginSSL: gmail.com
    [002:488] ContinueSSL
    [002:488] SSL_connect:before/connect initialization
    [002:489] SSL_connect:SSLv3 write client hello A
    [002:489] SSL_connect:error in SSLv3 read server hello A
    [002:489]  -- error want read
    [002:489] SEND >>>>>>>>>>>>>>>>>>>>>>>>> : Mon Jun 25 17:09:17 2012
    [002:489]    <stream:stream to="gmail.com" xml:lang="*" version="1.0" xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client">
    [002:530] ContinueSSL
    [002:530] SSL_connect:error in SSLv3 read server hello A
    [002:530]  -- error want read
    [002:531] ContinueSSL
    [002:531] SSL_connect:SSLv3 read server hello A
    [002:531] SSL_connect:SSLv3 read server certificate A
    [002:531] SSL_connect:SSLv3 read server done A
    [002:531] SSL_connect:SSLv3 write client key exchange A
    [002:532] SSL_connect:SSLv3 write change cipher spec A
    [002:532] SSL_connect:SSLv3 write finished A
    [002:532] SSL_connect:SSLv3 flush data
    [002:532] SSL_connect:error in SSLv3 read finished A
    [002:532]  -- error want read
    [002:575] ContinueSSL
    [002:575] SSL_connect:SSLv3 read finished A
    [002:575]  -- success
    [002:575] Certificate from server:
    [002:575]         Version: 3 (0x2)
            Serial Number:31:fa:c7:51:00:00:00:00:5b:30
        Signature Algorithm: sha1WithRSAEncryption
            Issuer: C=US, O=Google Inc, CN=Google Internet Authority
            Validity
                Not Before: Jun  5 00:52:14 2012 GMT
                Not After : Jun  5 01:02:14 2013 GMT
            Subject: C=US, ST=California, L=Mountain View, O=Google Inc, CN=gmail.com
            Subject Public Key Info:
                Public Key Algorithm: rsaEncryption
                    Public-Key: (1024 bit)
                    Modulus:...
                    Exponent: 65537 (0x10001)
            X509v3 extensions:
                X509v3 Extended Key Usage: 
                    TLS Web Server Authentication, TLS Web Client Authentication
                X509v3 Subject Key Identifier: 
                    E1:73:4D:BB:F5:22:C3:57:06:EA:BF:18:73:1F:91:29:EE:54:2A:17
                X509v3 Authority Key Identifier: 
                    keyid:BF:C0:30:EB:F5:43:11:3E:67:BA:9E:91:FB:FC:6A:DA:E3:6B:12:24
                X509v3 CRL Distribution Points: 
                    Full Name:URI:http://www.gstatic.com/GoogleInternetAuthority/GoogleInternetAuthority.crl
                Authority Information Access: 
                    CA Issuers - URI:http://www.gstatic.com/GoogleInternetAuthority/GoogleInternetAuthority.crt
                X509v3 Subject Alternative Name: DNS:gmail.com
        Signature Algorithm: sha1WithRSAEncryption...
    [002:575] Cipher: AES128-SHA SSLv3 Kx=RSA Au=RSA  Enc=AES(128)  Mac=SHA1
    [002:616] RECV <<<<<<<<<<<<<<<<<<<<<<<<< : Mon Jun 25 17:09:18 2012
    [002:616]    <stream:stream from="gmail.com" id="F585A9BF4936FE0D" version="1.0" xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client">
    [002:616] RECV <<<<<<<<<<<<<<<<<<<<<<<<< : Mon Jun 25 17:09:18 2012
    [002:616]    <stream:features>
    [002:616]      <mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl">
    [002:616]        <mechanism>
    [002:616]          PLAIN
    [002:616]        </mechanism>
    [002:616]        <mechanism>
    [002:616]          X-GOOGLE-TOKEN
    [002:616]        </mechanism>
    [002:616]        <mechanism>
    [002:616]          X-OAUTH2
    [002:616]        </mechanism>
    [002:616]      </mechanisms>
    [002:616]    </stream:features>
    [002:617] SEND >>>>>>>>>>>>>>>>>>>>>>>>> : Mon Jun 25 17:09:18 2012
    [002:617]    <auth xmlns="urn:ietf:params:xml:ns:xmpp-sasl" mechanism="PLAIN" auth:allow-non-google-login="true" auth:client-uses-full-bind-result="true" xmlns:auth="http://www.google.com/talk/protocol/auth">
    [002:617]      ## TEXT REMOVED ##
    [002:617]    </auth>
    [002:696] RECV <<<<<<<<<<<<<<<<<<<<<<<<< : Mon Jun 25 17:09:18 2012
    [002:696]    <success xmlns="urn:ietf:params:xml:ns:xmpp-sasl"/>
    [002:697] SEND >>>>>>>>>>>>>>>>>>>>>>>>> : Mon Jun 25 17:09:18 2012
    [002:697]    <stream:stream to="gmail.com" xml:lang="*" version="1.0" xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client">
    [002:737] RECV <<<<<<<<<<<<<<<<<<<<<<<<< : Mon Jun 25 17:09:18 2012
    [002:737]    <stream:stream from="gmail.com" id="A554FE81E66DED32" version="1.0" xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client">
    [002:737] RECV <<<<<<<<<<<<<<<<<<<<<<<<< : Mon Jun 25 17:09:18 2012
    [002:737]    <stream:features>
    [002:737]      <bind xmlns="urn:ietf:params:xml:ns:xmpp-bind"/>
    [002:737]      <session xmlns="urn:ietf:params:xml:ns:xmpp-session"/>
    [002:737]    </stream:features>
    [002:737] SEND >>>>>>>>>>>>>>>>>>>>>>>>> : Mon Jun 25 17:09:18 2012  
    [002:737]    <iq type="set" id="0">
    [002:737]      <bind xmlns="urn:ietf:params:xml:ns:xmpp-bind">
    [002:737]        <resource>
    [002:737]          pcp
    [002:737]        </resource>
    [002:737]      </bind>
    [002:737]    </iq>
    [002:777] RECV <<<<<<<<<<<<<<<<<<<<<<<<< : Mon Jun 25 17:09:18 2012
    [002:777]    <iq id="0" type="result">
    [002:777]      <bind xmlns="urn:ietf:params:xml:ns:xmpp-bind">
    [002:777]        <jid>
    [002:777]          forge...1@gmail.com/pcp7B23909E
    [002:777]        </jid>
    [002:777]      </bind>
    [002:777]    </iq>
    [002:777] SEND >>>>>>>>>>>>>>>>>>>>>>>>> : Mon Jun 25 17:09:18 2012
    [002:777]    <iq type="set" id="1">
    [002:777]      <session xmlns="urn:ietf:params:xml:ns:xmpp-session"/>
    [002:777]    </iq>
    [002:778] RECV <<<<<<<<<<<<<<<<<<<<<<<<< : Mon Jun 25 17:09:18 2012
    [002:817] RECV <<<<<<<<<<<<<<<<<<<<<<<<< : Mon Jun 25 17:09:18 2012  
    [002:817]    <iq type="result" id="1"/>
    logged in...
    [002:817] SEND >>>>>>>>>>>>>>>>>>>>>>>>> : Mon Jun 25 17:09:18 2012
    [002:817]    <presence>
    [002:817]      <priority>
    [002:817]        -1
    [002:817]      </priority>
    [002:817]    </presence>
    Logged in as forge...1@gmail.com/pcp7B23909E
    [002:817] Making key pair
    [002:822] Returning key pair
    [002:822] Making certificate for forge...1@gmail.com/pcp7B23909E
    [002:823] Returning certificate
    [002:823] TunnelSessionClientBase::OnSessionCreate: received=0
    [002:823] Session:2481285798 Old state:STATE_INIT New state:STATE_SENTINITIATE Type:http://www.google.com/talk/securetunnel Transport:http://www.google.com/transport/p2p
    [002:823] TunnelSession::OnSessionState(Session::STATE_SENTINITIATE)
    [002:823] SEND >>>>>>>>>>>>>>>>>>>>>>>>> : Mon Jun 25 17:09:18 2012
    [002:823]    <iq type="get" id="3">
    [002:823]      <query xmlns="google:jingleinfo"/>
    [002:823]    </iq>
    [002:823] SEND >>>>>>>>>>>>>>>>>>>>>>>>> : Mon Jun 25 17:09:18 2012
    [002:823]    <iq to="forge...2@gmail.com/pcp8B13E6B8" type="set" id="5">
    [002:823]      <jingle xmlns="urn:xmpp:jingle:1" action="session-initiate" sid="2481285798" initiator="forge...1@gmail.com/pcp7B23909E">
    [002:823]        <content name="securetunnel" creator="initiator">
    [002:823]          <description xmlns="http://www.google.com/talk/securetunnel">
    [002:823]            <type>
    [002:823]              recv:outputmainadobe.pdf
    [002:823]            </type>
    [002:823]            <client-cert>
    [002:823]              -----BEGIN CERTIFICATE-----...-----END CERTIFICATE-----
    [002:823]            </client-cert>
    [002:823]          </description>
    [002:823]          <transport xmlns="http://www.google.com/transport/p2p"/>
    [002:823]        </content>
    [002:823]      </jingle>
    [002:823]      <session xmlns="http://www.google.com/session" type="initiate" id="2481285798" initiator="forge...1@gmail.com/pcp7B23909E">
    [002:823]        <description xmlns="http://www.google.com/talk/securetunnel">
    [002:823]          <type>
    [002:823]            recv:outputmainadobe.pdf
    [002:823]          </type>
    [002:823]          <client-cert>
    [002:823]            -----BEGIN CERTIFICATE-----...-----END CERTIFICATE-----
    [002:823]          </client-cert>
    [002:823]        </description>
    [002:823]      </session>
    [002:823]    </iq>
    [002:867] RECV <<<<<<<<<<<<<<<<<<<<<<<<< : Mon Jun 25 17:09:18 2012
    [002:867]    <iq to="forge...1@gmail.com/pcp7B23909E" id="3" type="result">
    [002:867]      <query xmlns="google:jingleinfo">
    [002:867]        <stun>
    [002:867]          <server host="stun.l.google.com" udp="19302"/>
    [002:867]          <server host="alt3.stun.l.google.com" udp="19302"/>
    [002:867]          <server host="alt2.stun.l.google.com" udp="19302"/>
    [002:867]          <server host="alt4.stun.l.google.com" udp="19302"/>
    [002:867]          <server host="alt1.stun.l.google.com" udp="19302"/>
    [002:867]        </stun>
    [002:867]        <relay>
    [002:867]          <token>
    [002:867]            CAESHgoVZm9yZ2Vjb21tczFAZ21haWwuY29tEJXfqb2CJxoQy4rGyFRtv1QQGHf8AQWC0A==
    [002:867]          </token>
    [002:867]          <server host="relay.google.com" udp="19295" tcp="19294" tcpssl="443"/>
    [002:867]        </relay>
    [002:867]      </query>
    [002:867]    </iq>
    [002:880] RECV <<<<<<<<<<<<<<<<<<<<<<<<< : Mon Jun 25 17:09:18 2012
    [002:880]    <presence from="forge...1@gmail.com/pcp0C32AC91" to="forge...1@gmail.com/pcp7B23909E">
    [002:880]      <priority>
    [002:880]        -1
    [002:880]      </priority>
    [002:880]      <x xmlns="vcard-temp:x:update"/>
    [002:880]    </presence>
    [002:880] RECV <<<<<<<<<<<<<<<<<<<<<<<<< : Mon Jun 25 17:09:18 2012
    [002:882] RECV <<<<<<<<<<<<<<<<<<<<<<<<< : Mon Jun 25 17:09:18 2012   
    [002:882]    <presence from="cu...@gmail.com/gmail.17841843" to="forge...1@gmail.com/pcp7B23909E">
    [002:882]      <status/>
    [002:882]      <priority>
    [002:882]        24
    [002:882]      </priority>
    [002:882]      <caps:c node="http://mail.google.com/xmpp/client/caps" ver="1.1" ext="pmuc-v1 sms-v1 camera-v1 video-v1 voice-v1" xmlns:caps="http://jabber.org/protocol/caps"/>
    [002:882]      <x xmlns="vcard-temp:x:update">
    [002:882]        <photo>
    [002:882]          c632207e8c5c202147ccbd6c431334234750f966
    [002:882]        </photo>
    [002:882]      </x>
    [002:882]    </presence>
    [002:956] RECV <<<<<<<<<<<<<<<<<<<<<<<<< : Mon Jun 25 17:09:18 2012
    [002:956]    <iq to="forge...1@gmail.com/pcp7B23909E" type="error" id="5" from="forge...2@gmail.com/pcp8B13E6B8">
    [002:956]      <jingle action="session-initiate" sid="2481285798" initiator="forge...1@gmail.com/pcp7B23909E" xmlns="urn:xmpp:jingle:1">
    [002:956]        <content name="securetunnel" creator="initiator">
    [002:956]          <description xmlns="http://www.google.com/talk/securetunnel">
    [002:956]            <type>
    [002:956]              recv:outputmainadobe.pdf
    [002:956]            </type>
    [002:956]            <client-cert>
    [002:956] RECV <<<<<<<<<<<<<<<<<<<<<<<<< : Mon Jun 25 17:09:18 2012
    [002:956]    -----BEGIN CERTIFICATE-----...-----END CERTIFICATE-----
    [002:956]  </client-cert>
    [002:956]  </description>
    [002:956]  <transport xmlns="http://www.google.com/transport/p2p"/>
    [002:956]  </content>
    [002:956]  </jingle>
    [002:956]  <session type="initiate" id="2481285798" initiator="forge...1@gmail.com/pcp7B23909E" xmlns="http://www.google.com/session">
    [002:956]  <description xmlns="http://www.google.com/talk/securetunnel">
    [002:956]  <type>
    [002:956]  recv:outputmainadobe.pdf
    [002:956]  </type>
    [002:956]  <client-cert>
    [002:956] RECV <<<<<<<<<<<<<<<<<<<<<<<<< : Mon Jun 25 17:09:18 2012
    [002:956]    -----BEGIN CERTIFICATE-----...-----END CERTIFICATE-----
    [002:956]  </client-cert>
    [002:956]  </description>
    [002:956]  </session>
    [002:956]  <error code="503" type="cancel">
    [002:956]  <service-unavailable xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/>
    [002:956]  </error>
    [002:956]  </iq>
    [002:957] Error(session.cc:858): Session error:
    <cli:error code="503" type="cancel" xmlns:cli="jabber:client"><service-unavailable xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/></cli:error>
    in response to:
    <cli:iq to="forge...2@gmail.com/pcp8B13E6B8" type="set" id="5" xmlns:cli="jabber:client"><jingle xmlns="urn:xmpp:jingle:1" action="session-initiate" sid="2481285798" initiator="forge.1@gmail.com/pcp7B23909E"><content name="securetunnel" creator="initiator"><description xmlns="http://www.google.com/talk/securetunnel"><type>recv:outputmainadobe.pdf</type><client-cert>-----BEGIN CERTIFICATE-----...-----END CERTIFICATE-----
    </client-cert></description><transport xmlns="http://www.google.com/transport/p2p"/></content></jingle><session xmlns="http://www.google.com/session" type="initiate" id="2481285798" initiator="forge...1@gmail.com/pcp7B23909E"><description xmlns="http://www.google.com/talk/securetunnel"><type>recv:outputmainadobe.pdf</type><client-cert>-----BEGIN CERTIFICATE-----...----END CERTIFICATE-----
    </client-cert></description></session></cli:iq>
    [002:957] Session:2481285798 Old state:STATE_SENTINITIATE New state:STATE_SENTTERMINATE Type:http://www.google.com/talk/securetunnel Transport:http://www.google.com/transport/p2p
    [002:957] TunnelSession::OnSessionState(Session::STATE_SENTTERMINATE)
    [002:957] Destroying unconnected PseudoTcpChannel
    [002:957] SEND >>>>>>>>>>>>>>>>>>>>>>>>> : Mon Jun 25 17:09:18 2012
    [002:957]    <iq to="forge...2@gmail.com/pcp8B13E6B8" type="set" id="6">
    [002:957]      <jingle xmlns="urn:xmpp:jingle:1" action="session-terminate" sid="2481285798">
    [002:957]        <reason>
    [002:957]          <general-error/>
    [002:957]        </reason>
    [002:957]      </jingle>
    [002:957]      <session xmlns="http://www.google.com/session" type="terminate" id="2481285798" initiator="forge...1@gmail.com/pcp7B23909E">
    [002:957]        <general-error/>
    [002:957]      </session>
    [002:957]    </iq>
    [002:957] OpenSSLStreamAdapter::OnEvent(SE_CLOSE, -1)
    [002:957] Cleanup
    Tunnel closed with error: -1
    [002:957] Cleanup
    [002:957] TunnelSessionClientBase::OnSessionDestroy
    [002:957] Session:2481285798 Old state:STATE_SENTTERMINATE New state:STATE_DEINIT Type:http://www.google.com/talk/securetunnel Transport:http://www.google.com/transport/p2p
    [002:957] virtual void cricket::PseudoTcpChannel::OnMessage(talk_base::Message*): (MSG_SI_DESTROY)
    [002:957] SEND >>>>>>>>>>>>>>>>>>>>>>>>> : Mon Jun 25 17:09:18 2012
    [002:957]  </stream:stream>
    logged out...
    [002:957] Cleanup
    
    编辑:根据要求,我包含了一些代码(我将包括所有代码,但主文件是723行)。我仍然直接使用谷歌的LibJingle代码,未修改,因为我还没有能够使这个工作。可以找到此文件的完整代码here

    int main(int argc, char **argv) {
      talk_base::LogMessage::LogThreads();
      talk_base::LogMessage::LogTimestamps();
    
      // Parse the arguments.
      int index = 1;
      while (index < argc) {
        std::string name, value;
        if (!ParseArg(argv[index], &name, &value))
          break;
    
        if (name == "help") {
          Usage();
        } else if (name == "verbose") {
          talk_base::LogMessage::LogToDebug(talk_base::LS_VERBOSE);
        } else if (name == "xmpp-host") {
          gXmppHost = value;
        } else if (name == "xmpp-port") {
          gXmppPort = ParseIntArg(name, value);
        } else if (name == "xmpp-use-tls") {
          gXmppUseTls = ParseBoolArg(name, value)?
              buzz::TLS_REQUIRED : buzz::TLS_DISABLED;
        } else {
          Error(std::string("unknown option: ") + name);
        }
        index += 1;
      }
    
      if (index >= argc)
        Error("bad arguments");
      gUserJid = buzz::Jid(argv[index++]);
      if (!gUserJid.IsValid())
        Error("bad arguments");
    
      char path[MAX_PATH];
    #if WIN32
      GetCurrentDirectoryA(MAX_PATH, path);
    #else
      if (NULL == getcwd(path, MAX_PATH))
        Error("Unable to get current path");
    #endif
    
      std::cout << "Directory: " << std::string(path) << std::endl;
    
      buzz::Jid gSrcJid;
      buzz::Jid gDstJid;
      std::string gSrcFile;
      std::string gDstFile;
    
      bool as_server = true;
      if (index + 2 == argc) {
        ParseFileArg(argv[index], &gSrcJid, &gSrcFile);
        ParseFileArg(argv[index+1], &gDstJid, &gDstFile);
        if(gSrcJid.Str().empty() == gDstJid.Str().empty())
          Error("Exactly one of source JID or destination JID must be empty.");
        as_server = false;
      } else if (index != argc) {
        Error("bad arguments");
      }
    
      std::cout << "Password: ";
      SetConsoleEcho(false);
      std::cin >> gUserPass.password();
      SetConsoleEcho(true);
      std::cout << std::endl;
    
      talk_base::InitializeSSL();
      CustomXmppPump pump;// Log in.
      pump.client()->SignalLogInput.connect(&debug_log_, &DebugLog::Input);
      pump.client()->SignalLogOutput.connect(&debug_log_, &DebugLog::Output);
      pump.DoLogin(LoginSettings(), new XmppSocket(gXmppUseTls), 0);
    
      // Wait until login succeeds.
      std::vector<uint32> ids;
      ids.push_back(MSG_LOGIN_COMPLETE);
      ids.push_back(MSG_LOGIN_FAILED);
      if (MSG_LOGIN_FAILED == Loop(ids))
        FatalError("Failed to connect");{
        talk_base::scoped_ptr<buzz::XmlElement> presence(
          new buzz::XmlElement(buzz::QN_PRESENCE));
        presence->AddElement(new buzz::XmlElement(buzz::QN_PRIORITY));
        presence->AddText("-1", 1);
        pump.SendStanza(presence.get());
      }
    
      std::string user_jid_str = pump.client()->jid().Str();
      std::cout << "Logged in as " << user_jid_str << std::endl;
    
      // Prepare the random number generator.
      talk_base::InitRandom(user_jid_str.c_str(), user_jid_str.size());
    
      // Create the P2P session manager.
      talk_base::BasicNetworkManager network_manager;
      AutoPortAllocator allocator(&network_manager, "pcp_agent");
      allocator.SetXmppClient(pump.client());
      cricket::SessionManager session_manager(&allocator);
    #ifdef USE_SSL_TUNNEL
      cricket::SecureTunnelSessionClient session_client(pump.client()->jid(),
                                                        &session_manager);
      if (!session_client.GenerateIdentity())
        FatalError("Failed to generate SSL identity");
    #else  // !USE_SSL_TUNNEL
      cricket::TunnelSessionClient session_client(pump.client()->jid(),
                                                  &session_manager);
    #endif  // USE_SSL_TUNNEL
      cricket::SessionManagerTask *receiver =
          new cricket::SessionManagerTask(pump.client(), &session_manager);
      receiver->EnableOutgoingMessages();
      receiver->Start();
    
      bool success = true;
    
      if (as_server) {// Establish the appropriate connection.
        pump.Serve(&session_client);
      } else {
        talk_base::StreamInterface* stream = NULL;
        std::string filename;
        bool sending;
        if (gSrcJid.Str().empty()) {
          std::string message("recv:");
          message.append(gDstFile);
          stream = session_client.CreateTunnel(gDstJid, message);
          filename = gSrcFile;
          sending = true;
        } else {
          std::string message("send:");
          message.append(gSrcFile);
          stream = session_client.CreateTunnel(gSrcJid, message);
          filename = gDstFile;
          sending = false;
        }
        success = pump.ProcessStream(stream, filename, sending);
      }
    
      if (success) {
        // Wait until the copy is done.
        ids.clear();
        ids.push_back(MSG_DONE);
        ids.push_back(MSG_LOGIN_FAILED);
        Loop(ids);
      }
    
      pump.DoDisconnect();// Log out.
    
      return 0;
    }
    

1 个答案:

答案 0 :(得分:2)

好的,所以这个错误是因为错误的完整JID和错误的代码执行。 PCP应按照提供的顺序运行:

  1. 运行“./pcp receiveruser@host.com”并提供帐户密码。
  2. 读取代码输出中提供的receiveruser@host.com帐户的完整JID。如果可能,最简单的方法是在输出中搜索:“登录为”。将用户帐户信息中的“.com /”后的所有内容记录下来。
  3. 运行“./pcp senderuser@host.com send_file_name.extension receiveruser@host.com/(完整JID):received_file_name.extension”
  4. 发生此错误是因为正在使用的代码执行方法阻止将帐户视为可用。这与服务器错误或缺少Google服务无关(很抱歉让您怀疑,Google)。至于优先级为-1,这也与错误无关(如在读取XMPP后学到的)。