OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "blimp/net/blimp_message_checkpointer.h" | 5 #include "blimp/net/blimp_message_checkpointer.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "blimp/common/create_blimp_message.h" | 8 #include "blimp/common/create_blimp_message.h" |
9 #include "blimp/common/proto/blimp_message.pb.h" | 9 #include "blimp/common/proto/blimp_message.pb.h" |
10 #include "blimp/common/proto/protocol_control.pb.h" | 10 #include "blimp/common/proto/protocol_control.pb.h" |
(...skipping 17 matching lines...) Expand all Loading... | |
28 DCHECK(incoming_processor_); | 28 DCHECK(incoming_processor_); |
29 DCHECK(outgoing_processor_); | 29 DCHECK(outgoing_processor_); |
30 DCHECK(checkpoint_observer_); | 30 DCHECK(checkpoint_observer_); |
31 } | 31 } |
32 | 32 |
33 BlimpMessageCheckpointer::~BlimpMessageCheckpointer() {} | 33 BlimpMessageCheckpointer::~BlimpMessageCheckpointer() {} |
34 | 34 |
35 void BlimpMessageCheckpointer::ProcessMessage( | 35 void BlimpMessageCheckpointer::ProcessMessage( |
36 std::unique_ptr<BlimpMessage> message, | 36 std::unique_ptr<BlimpMessage> message, |
37 const net::CompletionCallback& callback) { | 37 const net::CompletionCallback& callback) { |
38 if (message->type() == BlimpMessage::PROTOCOL_CONTROL && | 38 if (message->has_protocol_control()) { |
Kevin M
2016/05/20 18:28:15
Check the feature case
shaktisahu
2016/05/20 22:29:41
Why? We are already doing that in the DCHECK above
| |
39 message->protocol_control().type() == | |
40 ProtocolControlMessage::CHECKPOINT_ACK) { | |
41 if (message->protocol_control().has_checkpoint_ack() && | 39 if (message->protocol_control().has_checkpoint_ack() && |
Kevin M
2016/05/20 18:28:16
Check the case here too
shaktisahu
2016/05/20 22:29:41
Ditto
| |
42 message->protocol_control().checkpoint_ack().has_checkpoint_id()) { | 40 message->protocol_control().checkpoint_ack().has_checkpoint_id()) { |
43 checkpoint_observer_->OnMessageCheckpoint( | 41 checkpoint_observer_->OnMessageCheckpoint( |
44 message->protocol_control().checkpoint_ack().checkpoint_id()); | 42 message->protocol_control().checkpoint_ack().checkpoint_id()); |
45 callback.Run(net::OK); | 43 callback.Run(net::OK); |
46 } else { | 44 } else { |
47 DLOG(WARNING) << "Invalid checkpoint ACK. Dropping connection."; | 45 DLOG(WARNING) << "Invalid checkpoint ACK. Dropping connection."; |
48 callback.Run(net::ERR_FAILED); | 46 callback.Run(net::ERR_FAILED); |
49 } | 47 } |
50 | 48 |
51 return; | 49 return; |
(...skipping 24 matching lines...) Expand all Loading... | |
76 int result) { | 74 int result) { |
77 callback.Run(result); | 75 callback.Run(result); |
78 } | 76 } |
79 | 77 |
80 void BlimpMessageCheckpointer::SendCheckpointAck() { | 78 void BlimpMessageCheckpointer::SendCheckpointAck() { |
81 outgoing_processor_->ProcessMessage( | 79 outgoing_processor_->ProcessMessage( |
82 CreateCheckpointAckMessage(checkpoint_id_), net::CompletionCallback()); | 80 CreateCheckpointAckMessage(checkpoint_id_), net::CompletionCallback()); |
83 } | 81 } |
84 | 82 |
85 } // namespace blimp | 83 } // namespace blimp |
OLD | NEW |