OLD | NEW |
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 "net/socket/tcp_client_socket.h" | 5 #include "net/socket/tcp_client_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 <sys/socket.h> | 10 #include <sys/socket.h> |
(...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
572 bool TCPClientSocketLibevent::SetKeepAlive(bool enable, int delay) { | 572 bool TCPClientSocketLibevent::SetKeepAlive(bool enable, int delay) { |
573 int socket = socket_ != kInvalidSocket ? socket_ : bound_socket_; | 573 int socket = socket_ != kInvalidSocket ? socket_ : bound_socket_; |
574 return SetTCPKeepAlive(socket, enable, delay); | 574 return SetTCPKeepAlive(socket, enable, delay); |
575 } | 575 } |
576 | 576 |
577 bool TCPClientSocketLibevent::SetNoDelay(bool no_delay) { | 577 bool TCPClientSocketLibevent::SetNoDelay(bool no_delay) { |
578 int socket = socket_ != kInvalidSocket ? socket_ : bound_socket_; | 578 int socket = socket_ != kInvalidSocket ? socket_ : bound_socket_; |
579 return SetTCPNoDelay(socket, no_delay); | 579 return SetTCPNoDelay(socket, no_delay); |
580 } | 580 } |
581 | 581 |
| 582 void TCPClientSocketLibevent::ReadWatcher::OnFileCanReadWithoutBlocking(int) { |
| 583 if (!socket_->read_callback_.is_null()) |
| 584 socket_->DidCompleteRead(); |
| 585 } |
| 586 |
| 587 void TCPClientSocketLibevent::WriteWatcher::OnFileCanWriteWithoutBlocking(int) { |
| 588 if (socket_->waiting_connect()) { |
| 589 socket_->DidCompleteConnect(); |
| 590 } else if (!socket_->write_callback_.is_null()) { |
| 591 socket_->DidCompleteWrite(); |
| 592 } |
| 593 } |
| 594 |
582 void TCPClientSocketLibevent::LogConnectCompletion(int net_error) { | 595 void TCPClientSocketLibevent::LogConnectCompletion(int net_error) { |
583 if (net_error == OK) | 596 if (net_error == OK) |
584 UpdateConnectionTypeHistograms(CONNECTION_ANY); | 597 UpdateConnectionTypeHistograms(CONNECTION_ANY); |
585 | 598 |
586 if (net_error != OK) { | 599 if (net_error != OK) { |
587 net_log_.EndEventWithNetErrorCode(NetLog::TYPE_TCP_CONNECT, net_error); | 600 net_log_.EndEventWithNetErrorCode(NetLog::TYPE_TCP_CONNECT, net_error); |
588 return; | 601 return; |
589 } | 602 } |
590 | 603 |
591 SockaddrStorage storage; | 604 SockaddrStorage storage; |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
770 | 783 |
771 NextProto TCPClientSocketLibevent::GetNegotiatedProtocol() const { | 784 NextProto TCPClientSocketLibevent::GetNegotiatedProtocol() const { |
772 return kProtoUnknown; | 785 return kProtoUnknown; |
773 } | 786 } |
774 | 787 |
775 bool TCPClientSocketLibevent::GetSSLInfo(SSLInfo* ssl_info) { | 788 bool TCPClientSocketLibevent::GetSSLInfo(SSLInfo* ssl_info) { |
776 return false; | 789 return false; |
777 } | 790 } |
778 | 791 |
779 } // namespace net | 792 } // namespace net |
OLD | NEW |