Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(468)

Unified Diff: remoting/protocol/jingle_session.h

Issue 2417913002: Process incoming IQs in the same order that they were sent. (Closed)
Patch Set: Rebase Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | remoting/protocol/jingle_session.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/protocol/jingle_session.h
diff --git a/remoting/protocol/jingle_session.h b/remoting/protocol/jingle_session.h
index 0c16edfe4d84b86123d0f19887dc7ea8bd93ef71..5d53a4b6a303f95e3c4dbf62cff7f1b467ec203e 100644
--- a/remoting/protocol/jingle_session.h
+++ b/remoting/protocol/jingle_session.h
@@ -11,6 +11,8 @@
#include "base/macros.h"
#include "base/memory/ref_counted.h"
+#include "base/rand_util.h"
+#include "base/strings/string_number_conversions.h"
#include "base/threading/thread_checker.h"
#include "base/timer/timer.h"
#include "crypto/rsa_private_key.h"
@@ -81,9 +83,15 @@ class JingleSession : public Session {
// Called by JingleSessionManager on incoming |message|. Must call
// |reply_callback| to send reply message before sending any other
// messages.
- void OnIncomingMessage(std::unique_ptr<JingleMessage> message,
+ void OnIncomingMessage(const std::string& id,
+ std::unique_ptr<JingleMessage> message,
const ReplyCallback& reply_callback);
+ // Called by OnIncomingMessage() to process the incoming Jingle messages
+ // in the same order that they are sent.
+ void ProcessIncomingMessage(std::unique_ptr<JingleMessage> message,
+ const ReplyCallback& reply_callback);
+
// Message handlers for incoming messages.
void OnAccept(std::unique_ptr<JingleMessage> message,
const ReplyCallback& reply_callback);
@@ -113,6 +121,10 @@ class JingleSession : public Session {
// Returns true if the state of the session is not CLOSED or FAILED
bool is_session_active();
+ // Returns the value of the ID attribute of the next outgoing set IQ with the
+ // sequence ID encoded.
+ std::string GetNextOutgoingId();
+
base::ThreadChecker thread_checker_;
JingleSessionManager* session_manager_;
@@ -135,6 +147,23 @@ class JingleSession : public Session {
// Pending transport-info requests.
std::list<std::unique_ptr<IqRequest>> transport_info_requests_;
+ struct PendingMessage {
+ PendingMessage(std::unique_ptr<JingleMessage> message,
+ const ReplyCallback& reply_callback);
+ ~PendingMessage();
+ std::unique_ptr<JingleMessage> message;
+ const ReplyCallback reply_callback;
+ };
+
+ // A message queue to guarantee the incoming messages are processed in order.
+ class OrderedMessageQueue;
+ std::unique_ptr<OrderedMessageQueue> message_queue_;
+
+ // This prefix is necessary to disambiguate between the ID's sent from the
+ // client and the ID's sent from the host.
+ std::string outgoing_id_prefix_ = base::Uint64ToString(base::RandUint64());
+ int next_outgoing_id_ = 0;
+
base::WeakPtrFactory<JingleSession> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(JingleSession);
« no previous file with comments | « no previous file | remoting/protocol/jingle_session.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698