OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "google_apis/gcm/engine/mcs_client.h" | 5 #include "google_apis/gcm/engine/mcs_client.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 752 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
763 acked_outgoing_persistent_ids, | 763 acked_outgoing_persistent_ids, |
764 base::Bind(&MCSClient::OnGCMUpdateFinished, | 764 base::Bind(&MCSClient::OnGCMUpdateFinished, |
765 weak_ptr_factory_.GetWeakPtr())); | 765 weak_ptr_factory_.GetWeakPtr())); |
766 | 766 |
767 HandleServerConfirmedReceipt(last_stream_id_received); | 767 HandleServerConfirmedReceipt(last_stream_id_received); |
768 } | 768 } |
769 | 769 |
770 void MCSClient::HandleSelectiveAck(const PersistentIdList& id_list) { | 770 void MCSClient::HandleSelectiveAck(const PersistentIdList& id_list) { |
771 std::set<PersistentId> remaining_ids(id_list.begin(), id_list.end()); | 771 std::set<PersistentId> remaining_ids(id_list.begin(), id_list.end()); |
772 | 772 |
773 StreamId last_stream_id_received = -1; | 773 // !!! This looks really wrong, shouldn't this be zero? |
774 StreamId last_stream_id_received = 0xFFFFFFFF; | |
Peter Kasting
2014/07/09 22:19:54
This needs review. See how code below tries to ch
Nicolas Zea
2014/07/09 22:52:35
You're right, this is broken. The lines at 815 are
Peter Kasting
2014/07/09 23:34:25
Done.
| |
774 | 775 |
775 // First check the to_resend_ queue. Acknowledgments are always contiguous, | 776 // First check the to_resend_ queue. Acknowledgments are always contiguous, |
776 // so if there's a pending message that hasn't been acked, all newer messages | 777 // so if there's a pending message that hasn't been acked, all newer messages |
777 // must also be unacked. | 778 // must also be unacked. |
778 while(!to_resend_.empty() && !remaining_ids.empty()) { | 779 while(!to_resend_.empty() && !remaining_ids.empty()) { |
779 const MCSPacketInternal& outgoing_packet = to_resend_.front(); | 780 const MCSPacketInternal& outgoing_packet = to_resend_.front(); |
780 if (remaining_ids.count(outgoing_packet->persistent_id) == 0) | 781 if (remaining_ids.count(outgoing_packet->persistent_id) == 0) |
781 break; // Newer message must be unacked too. | 782 break; // Newer message must be unacked too. |
782 remaining_ids.erase(outgoing_packet->persistent_id); | 783 remaining_ids.erase(outgoing_packet->persistent_id); |
783 NotifyMessageSendStatus(*outgoing_packet->protobuf, SENT); | 784 NotifyMessageSendStatus(*outgoing_packet->protobuf, SENT); |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
901 reinterpret_cast<mcs_proto::DataMessageStanza*>(packet->protobuf.get()); | 902 reinterpret_cast<mcs_proto::DataMessageStanza*>(packet->protobuf.get()); |
902 CollapseKey collapse_key(*data_message); | 903 CollapseKey collapse_key(*data_message); |
903 if (collapse_key.IsValid()) | 904 if (collapse_key.IsValid()) |
904 collapse_key_map_.erase(collapse_key); | 905 collapse_key_map_.erase(collapse_key); |
905 } | 906 } |
906 | 907 |
907 return packet; | 908 return packet; |
908 } | 909 } |
909 | 910 |
910 } // namespace gcm | 911 } // namespace gcm |
OLD | NEW |