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_producer_dispatcher.h" | 5 #include "mojo/edk/system/data_pipe_producer_dispatcher.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <utility> | 10 #include <utility> |
(...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
497 | 497 |
498 ports::PortStatus port_status; | 498 ports::PortStatus port_status; |
499 int rv = node_controller_->node()->GetStatus(control_port_, &port_status); | 499 int rv = node_controller_->node()->GetStatus(control_port_, &port_status); |
500 if (rv != ports::OK || !port_status.receiving_messages) { | 500 if (rv != ports::OK || !port_status.receiving_messages) { |
501 DVLOG(1) << "Data pipe producer " << pipe_id_ << " is aware of peer closure" | 501 DVLOG(1) << "Data pipe producer " << pipe_id_ << " is aware of peer closure" |
502 << " [control_port=" << control_port_.name() << "]"; | 502 << " [control_port=" << control_port_.name() << "]"; |
503 peer_closed_ = true; | 503 peer_closed_ = true; |
504 } else if (rv == ports::OK && port_status.has_messages && !in_transit_) { | 504 } else if (rv == ports::OK && port_status.has_messages && !in_transit_) { |
505 ports::ScopedMessage message; | 505 ports::ScopedMessage message; |
506 do { | 506 do { |
507 int rv = node_controller_->node()->GetMessageIf(control_port_, nullptr, | 507 int rv = node_controller_->node()->GetMessage( |
508 &message); | 508 control_port_, &message, nullptr); |
509 if (rv != ports::OK) | 509 if (rv != ports::OK) |
510 peer_closed_ = true; | 510 peer_closed_ = true; |
511 if (message) { | 511 if (message) { |
512 if (message->num_payload_bytes() < sizeof(DataPipeControlMessage)) { | 512 if (message->num_payload_bytes() < sizeof(DataPipeControlMessage)) { |
513 peer_closed_ = true; | 513 peer_closed_ = true; |
514 break; | 514 break; |
515 } | 515 } |
516 | 516 |
517 const DataPipeControlMessage* m = | 517 const DataPipeControlMessage* m = |
518 static_cast<const DataPipeControlMessage*>( | 518 static_cast<const DataPipeControlMessage*>( |
(...skipping 21 matching lines...) Expand all Loading... |
540 } | 540 } |
541 | 541 |
542 if (peer_closed_ != was_peer_closed || | 542 if (peer_closed_ != was_peer_closed || |
543 available_capacity_ != previous_capacity) { | 543 available_capacity_ != previous_capacity) { |
544 awakable_list_.AwakeForStateChange(GetHandleSignalsStateNoLock()); | 544 awakable_list_.AwakeForStateChange(GetHandleSignalsStateNoLock()); |
545 } | 545 } |
546 } | 546 } |
547 | 547 |
548 } // namespace edk | 548 } // namespace edk |
549 } // namespace mojo | 549 } // namespace mojo |
OLD | NEW |