| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "remoting/protocol/jingle_session.h" | 5 #include "remoting/protocol/jingle_session.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <limits> | 9 #include <limits> |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 // Extracts a sequential id from the id attribute of the IQ stanza. | 78 // Extracts a sequential id from the id attribute of the IQ stanza. |
| 79 int GetSequentialId(const std::string& id) { | 79 int GetSequentialId(const std::string& id) { |
| 80 std::vector<std::string> tokens = | 80 std::vector<std::string> tokens = |
| 81 SplitString(id, "_", base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY); | 81 SplitString(id, "_", base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY); |
| 82 // Legacy endpoints does not encode the IQ ordering in the ID attribute | 82 // Legacy endpoints does not encode the IQ ordering in the ID attribute |
| 83 if (tokens.size() != 2) { | 83 if (tokens.size() != 2) { |
| 84 return kInvalid; | 84 return kInvalid; |
| 85 } | 85 } |
| 86 | 86 |
| 87 int result = kInvalid; | 87 int result = kInvalid; |
| 88 if (!base::StringToInt(tokens[1].c_str(), &result)) { | 88 if (!base::StringToInt(tokens[1], &result)) { |
| 89 return kInvalid; | 89 return kInvalid; |
| 90 } | 90 } |
| 91 return result; | 91 return result; |
| 92 } | 92 } |
| 93 | 93 |
| 94 } // namespace | 94 } // namespace |
| 95 | 95 |
| 96 // A Queue that sorts incoming messages and returns them in the ascending order | 96 // A Queue that sorts incoming messages and returns them in the ascending order |
| 97 // of sequence ids. The sequence id can be extracted from the ID attribute of | 97 // of sequence ids. The sequence id can be extracted from the ID attribute of |
| 98 // an IQ stanza, which have the following format <opaque_string>_<sequence_id>. | 98 // an IQ stanza, which have the following format <opaque_string>_<sequence_id>. |
| (...skipping 699 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 798 authenticator_->GetNextMessage())); | 798 authenticator_->GetNextMessage())); |
| 799 SendMessage(std::move(message)); | 799 SendMessage(std::move(message)); |
| 800 } | 800 } |
| 801 | 801 |
| 802 std::string JingleSession::GetNextOutgoingId() { | 802 std::string JingleSession::GetNextOutgoingId() { |
| 803 return outgoing_id_prefix_ + "_" + base::IntToString(++next_outgoing_id_); | 803 return outgoing_id_prefix_ + "_" + base::IntToString(++next_outgoing_id_); |
| 804 } | 804 } |
| 805 | 805 |
| 806 } // namespace protocol | 806 } // namespace protocol |
| 807 } // namespace remoting | 807 } // namespace remoting |
| OLD | NEW |