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

Side by Side Diff: net/socket/tcp_socket_libevent.cc

Issue 100253002: Don't HANDLE_EINTR(close). Either IGNORE_EINTR(close) or just close. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years 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 | Annotate | Revision Log
« no previous file with comments | « net/socket/tcp_listen_socket_unittest.cc ('k') | net/socket/unix_domain_socket_posix.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "net/socket/tcp_socket.h" 5 #include "net/socket/tcp_socket.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 #include <fcntl.h> 8 #include <fcntl.h>
9 #include <netdb.h> 9 #include <netdb.h>
10 #include <netinet/in.h> 10 #include <netinet/in.h>
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after
514 DCHECK(CalledOnValidThread()); 514 DCHECK(CalledOnValidThread());
515 515
516 bool ok = accept_socket_watcher_.StopWatchingFileDescriptor(); 516 bool ok = accept_socket_watcher_.StopWatchingFileDescriptor();
517 DCHECK(ok); 517 DCHECK(ok);
518 ok = read_socket_watcher_.StopWatchingFileDescriptor(); 518 ok = read_socket_watcher_.StopWatchingFileDescriptor();
519 DCHECK(ok); 519 DCHECK(ok);
520 ok = write_socket_watcher_.StopWatchingFileDescriptor(); 520 ok = write_socket_watcher_.StopWatchingFileDescriptor();
521 DCHECK(ok); 521 DCHECK(ok);
522 522
523 if (socket_ != kInvalidSocket) { 523 if (socket_ != kInvalidSocket) {
524 if (HANDLE_EINTR(close(socket_)) < 0) 524 if (IGNORE_EINTR(close(socket_)) < 0)
525 PLOG(ERROR) << "close"; 525 PLOG(ERROR) << "close";
526 socket_ = kInvalidSocket; 526 socket_ = kInvalidSocket;
527 } 527 }
528 528
529 if (!accept_callback_.is_null()) { 529 if (!accept_callback_.is_null()) {
530 accept_socket_ = NULL; 530 accept_socket_ = NULL;
531 accept_address_ = NULL; 531 accept_address_ = NULL;
532 accept_callback_.Reset(); 532 accept_callback_.Reset();
533 } 533 }
534 534
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
583 if (new_socket < 0) { 583 if (new_socket < 0) {
584 int net_error = MapAcceptError(errno); 584 int net_error = MapAcceptError(errno);
585 if (net_error != ERR_IO_PENDING) 585 if (net_error != ERR_IO_PENDING)
586 net_log_.EndEventWithNetErrorCode(NetLog::TYPE_TCP_ACCEPT, net_error); 586 net_log_.EndEventWithNetErrorCode(NetLog::TYPE_TCP_ACCEPT, net_error);
587 return net_error; 587 return net_error;
588 } 588 }
589 589
590 IPEndPoint ip_end_point; 590 IPEndPoint ip_end_point;
591 if (!ip_end_point.FromSockAddr(storage.addr, storage.addr_len)) { 591 if (!ip_end_point.FromSockAddr(storage.addr, storage.addr_len)) {
592 NOTREACHED(); 592 NOTREACHED();
593 if (HANDLE_EINTR(close(new_socket)) < 0) 593 if (IGNORE_EINTR(close(new_socket)) < 0)
594 PLOG(ERROR) << "close"; 594 PLOG(ERROR) << "close";
595 net_log_.EndEventWithNetErrorCode(NetLog::TYPE_TCP_ACCEPT, 595 net_log_.EndEventWithNetErrorCode(NetLog::TYPE_TCP_ACCEPT,
596 ERR_ADDRESS_INVALID); 596 ERR_ADDRESS_INVALID);
597 return ERR_ADDRESS_INVALID; 597 return ERR_ADDRESS_INVALID;
598 } 598 }
599 scoped_ptr<TCPSocketLibevent> tcp_socket(new TCPSocketLibevent( 599 scoped_ptr<TCPSocketLibevent> tcp_socket(new TCPSocketLibevent(
600 net_log_.net_log(), net_log_.source())); 600 net_log_.net_log(), net_log_.source()));
601 int adopt_result = tcp_socket->AdoptConnectedSocket(new_socket, ip_end_point); 601 int adopt_result = tcp_socket->AdoptConnectedSocket(new_socket, ip_end_point);
602 if (adopt_result != OK) { 602 if (adopt_result != OK) {
603 net_log_.EndEventWithNetErrorCode(NetLog::TYPE_TCP_ACCEPT, adopt_result); 603 net_log_.EndEventWithNetErrorCode(NetLog::TYPE_TCP_ACCEPT, adopt_result);
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
876 } 876 }
877 } else { 877 } else {
878 fast_open_status_ = (fast_open_status_ == FAST_OPEN_FAST_CONNECT_RETURN ? 878 fast_open_status_ = (fast_open_status_ == FAST_OPEN_FAST_CONNECT_RETURN ?
879 FAST_OPEN_SYN_DATA_FAILED : 879 FAST_OPEN_SYN_DATA_FAILED :
880 FAST_OPEN_NO_SYN_DATA_FAILED); 880 FAST_OPEN_NO_SYN_DATA_FAILED);
881 } 881 }
882 } 882 }
883 } 883 }
884 884
885 } // namespace net 885 } // namespace net
OLDNEW
« no previous file with comments | « net/socket/tcp_listen_socket_unittest.cc ('k') | net/socket/unix_domain_socket_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698