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

Side by Side Diff: ipc/ipc_channel_posix.cc

Issue 131513018: Signal error on send message failure. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 10 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "ipc/ipc_channel_posix.h" 5 #include "ipc/ipc_channel_posix.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 #include <fcntl.h> 8 #include <fcntl.h>
9 #include <stddef.h> 9 #include <stddef.h>
10 #include <sys/socket.h> 10 #include <sys/socket.h>
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after
465 465
466 if (bytes_written < 0 && !SocketWriteErrorIsRecoverable()) { 466 if (bytes_written < 0 && !SocketWriteErrorIsRecoverable()) {
467 #if defined(OS_MACOSX) 467 #if defined(OS_MACOSX)
468 // On OSX writing to a pipe with no listener returns EPERM. 468 // On OSX writing to a pipe with no listener returns EPERM.
469 if (errno == EPERM) { 469 if (errno == EPERM) {
470 Close(); 470 Close();
471 return false; 471 return false;
472 } 472 }
473 #endif // OS_MACOSX 473 #endif // OS_MACOSX
474 if (errno == EPIPE) { 474 if (errno == EPIPE) {
475 Close(); 475 Close();
Fredrik Öhrn 2014/01/29 10:41:00 Yet another alternative is to change Close to Clos
476 return false; 476 return false;
477 } 477 }
478 PLOG(ERROR) << "pipe error on " 478 PLOG(ERROR) << "pipe error on "
479 << fd_written 479 << fd_written
480 << " Currently writing message of size: " 480 << " Currently writing message of size: "
481 << msg->size(); 481 << msg->size();
482 return false; 482 return false;
483 } 483 }
484 484
485 if (static_cast<size_t>(bytes_written) != amt_to_write) { 485 if (static_cast<size_t>(bytes_written) != amt_to_write) {
(...skipping 29 matching lines...) Expand all
515 << " with type " << message->type() 515 << " with type " << message->type()
516 << " (" << output_queue_.size() << " in queue)"; 516 << " (" << output_queue_.size() << " in queue)";
517 517
518 #ifdef IPC_MESSAGE_LOG_ENABLED 518 #ifdef IPC_MESSAGE_LOG_ENABLED
519 Logging::GetInstance()->OnSendMessage(message, ""); 519 Logging::GetInstance()->OnSendMessage(message, "");
520 #endif // IPC_MESSAGE_LOG_ENABLED 520 #endif // IPC_MESSAGE_LOG_ENABLED
521 521
522 message->TraceMessageBegin(); 522 message->TraceMessageBegin();
523 output_queue_.push(message); 523 output_queue_.push(message);
524 if (!is_blocked_on_write_ && !waiting_connect_) { 524 if (!is_blocked_on_write_ && !waiting_connect_) {
525 return ProcessOutgoingMessages(); 525 if (!ProcessOutgoingMessages()) {
526 ClosePipeOnError();
527 return false;
528 }
526 } 529 }
527 530
528 return true; 531 return true;
529 } 532 }
530 533
531 int Channel::ChannelImpl::GetClientFileDescriptor() { 534 int Channel::ChannelImpl::GetClientFileDescriptor() {
532 base::AutoLock lock(client_pipe_lock_); 535 base::AutoLock lock(client_pipe_lock_);
533 return client_pipe_; 536 return client_pipe_;
534 } 537 }
535 538
(...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after
1101 1104
1102 1105
1103 #if defined(OS_LINUX) 1106 #if defined(OS_LINUX)
1104 // static 1107 // static
1105 void Channel::SetGlobalPid(int pid) { 1108 void Channel::SetGlobalPid(int pid) {
1106 ChannelImpl::SetGlobalPid(pid); 1109 ChannelImpl::SetGlobalPid(pid);
1107 } 1110 }
1108 #endif // OS_LINUX 1111 #endif // OS_LINUX
1109 1112
1110 } // namespace IPC 1113 } // namespace IPC
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698