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

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

Issue 332793002: Add a NetLog event for when sockets are closed. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « net/base/net_log_event_type_list.h ('k') | 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 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_win.h" 5 #include "net/socket/tcp_socket_win.h"
6 6
7 #include <mstcpip.h> 7 #include <mstcpip.h>
8 8
9 #include "base/callback_helpers.h" 9 #include "base/callback_helpers.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after
634 } 634 }
635 635
636 bool TCPSocketWin::SetNoDelay(bool no_delay) { 636 bool TCPSocketWin::SetNoDelay(bool no_delay) {
637 return DisableNagle(socket_, no_delay); 637 return DisableNagle(socket_, no_delay);
638 } 638 }
639 639
640 void TCPSocketWin::Close() { 640 void TCPSocketWin::Close() {
641 DCHECK(CalledOnValidThread()); 641 DCHECK(CalledOnValidThread());
642 642
643 if (socket_ != INVALID_SOCKET) { 643 if (socket_ != INVALID_SOCKET) {
644 // Only log the close event if there's actually a socket to close.
645 net_log_.AddEvent(NetLog::EventType::TYPE_SOCKET_CLOSED);
646
644 // Note: don't use CancelIo to cancel pending IO because it doesn't work 647 // Note: don't use CancelIo to cancel pending IO because it doesn't work
645 // when there is a Winsock layered service provider. 648 // when there is a Winsock layered service provider.
646 649
647 // In most socket implementations, closing a socket results in a graceful 650 // In most socket implementations, closing a socket results in a graceful
648 // connection shutdown, but in Winsock we have to call shutdown explicitly. 651 // connection shutdown, but in Winsock we have to call shutdown explicitly.
649 // See the MSDN page "Graceful Shutdown, Linger Options, and Socket Closure" 652 // See the MSDN page "Graceful Shutdown, Linger Options, and Socket Closure"
650 // at http://msdn.microsoft.com/en-us/library/ms738547.aspx 653 // at http://msdn.microsoft.com/en-us/library/ms738547.aspx
651 shutdown(socket_, SD_SEND); 654 shutdown(socket_, SD_SEND);
652 655
653 // This cancels any pending IO. 656 // This cancels any pending IO.
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
1012 waiting_read_ = false; 1015 waiting_read_ = false;
1013 core_->read_iobuffer_ = NULL; 1016 core_->read_iobuffer_ = NULL;
1014 core_->read_buffer_length_ = 0; 1017 core_->read_buffer_length_ = 0;
1015 1018
1016 DCHECK_NE(rv, ERR_IO_PENDING); 1019 DCHECK_NE(rv, ERR_IO_PENDING);
1017 base::ResetAndReturn(&read_callback_).Run(rv); 1020 base::ResetAndReturn(&read_callback_).Run(rv);
1018 } 1021 }
1019 1022
1020 } // namespace net 1023 } // namespace net
1021 1024
OLDNEW
« no previous file with comments | « net/base/net_log_event_type_list.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698