| 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 "mojo/edk/system/data_pipe_consumer_dispatcher.h" | 5 #include "mojo/edk/system/data_pipe_consumer_dispatcher.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 528 } | 528 } |
| 529 | 529 |
| 530 if (port_status.has_messages && !in_transit_) { | 530 if (port_status.has_messages && !in_transit_) { |
| 531 ports::ScopedMessage message; | 531 ports::ScopedMessage message; |
| 532 do { | 532 do { |
| 533 int rv = node_controller_->node()->GetMessageIf(control_port_, nullptr, | 533 int rv = node_controller_->node()->GetMessageIf(control_port_, nullptr, |
| 534 &message); | 534 &message); |
| 535 if (rv != ports::OK) | 535 if (rv != ports::OK) |
| 536 peer_closed_ = true; | 536 peer_closed_ = true; |
| 537 if (message) { | 537 if (message) { |
| 538 if (message->num_payload_bytes() < sizeof(DataPipeControlMessage)) { |
| 539 peer_closed_ = true; |
| 540 break; |
| 541 } |
| 542 |
| 538 const DataPipeControlMessage* m = | 543 const DataPipeControlMessage* m = |
| 539 static_cast<const DataPipeControlMessage*>( | 544 static_cast<const DataPipeControlMessage*>( |
| 540 message->payload_bytes()); | 545 message->payload_bytes()); |
| 541 | 546 |
| 542 if (m->command != DataPipeCommand::DATA_WAS_WRITTEN) { | 547 if (m->command != DataPipeCommand::DATA_WAS_WRITTEN) { |
| 543 DLOG(ERROR) << "Unexpected control message from producer."; | 548 DLOG(ERROR) << "Unexpected control message from producer."; |
| 544 peer_closed_ = true; | 549 peer_closed_ = true; |
| 545 break; | 550 break; |
| 546 } | 551 } |
| 547 | 552 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 562 } | 567 } |
| 563 | 568 |
| 564 if (peer_closed_ != was_peer_closed || | 569 if (peer_closed_ != was_peer_closed || |
| 565 bytes_available_ != previous_bytes_available) { | 570 bytes_available_ != previous_bytes_available) { |
| 566 awakable_list_.AwakeForStateChange(GetHandleSignalsStateNoLock()); | 571 awakable_list_.AwakeForStateChange(GetHandleSignalsStateNoLock()); |
| 567 } | 572 } |
| 568 } | 573 } |
| 569 | 574 |
| 570 } // namespace edk | 575 } // namespace edk |
| 571 } // namespace mojo | 576 } // namespace mojo |
| OLD | NEW |