OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/tools/flip_server/sm_connection.h" | 5 #include "net/tools/flip_server/sm_connection.h" |
6 | 6 |
7 #include <errno.h> | 7 #include <errno.h> |
8 #include <netinet/tcp.h> | 8 #include <netinet/tcp.h> |
9 #include <sys/socket.h> | 9 #include <sys/socket.h> |
10 #include <unistd.h> | 10 #include <unistd.h> |
11 | 11 |
12 #include <algorithm> | 12 #include <algorithm> |
13 #include <list> | 13 #include <list> |
14 #include <string> | 14 #include <string> |
15 | 15 |
16 #include "net/tools/flip_server/constants.h" | 16 #include "net/tools/flip_server/constants.h" |
17 #include "net/tools/flip_server/create_listener.h" | |
18 #include "net/tools/flip_server/flip_config.h" | 17 #include "net/tools/flip_server/flip_config.h" |
19 #include "net/tools/flip_server/http_interface.h" | 18 #include "net/tools/flip_server/http_interface.h" |
20 #include "net/tools/flip_server/spdy_interface.h" | 19 #include "net/tools/flip_server/spdy_interface.h" |
21 #include "net/tools/flip_server/spdy_ssl.h" | 20 #include "net/tools/flip_server/spdy_ssl.h" |
22 #include "net/tools/flip_server/streamer_interface.h" | 21 #include "net/tools/flip_server/streamer_interface.h" |
| 22 #include "net/tools/flip_server/tcp_socket_util.h" |
23 | 23 |
24 namespace net { | 24 namespace net { |
25 | 25 |
26 // static | 26 // static |
27 bool SMConnection::force_spdy_ = false; | 27 bool SMConnection::force_spdy_ = false; |
28 | 28 |
29 DataFrame::~DataFrame() { | 29 DataFrame::~DataFrame() { |
30 if (delete_when_done) | 30 if (delete_when_done) |
31 delete[] data; | 31 delete[] data; |
32 } | 32 } |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 if (fd == -1) { | 95 if (fd == -1) { |
96 // If fd == -1, then we are initializing a new connection that will | 96 // If fd == -1, then we are initializing a new connection that will |
97 // connect to the backend. | 97 // connect to the backend. |
98 // | 98 // |
99 // ret: -1 == error | 99 // ret: -1 == error |
100 // 0 == connection in progress | 100 // 0 == connection in progress |
101 // 1 == connection complete | 101 // 1 == connection complete |
102 // TODO(kelindsay): is_numeric_host_address value needs to be detected | 102 // TODO(kelindsay): is_numeric_host_address value needs to be detected |
103 server_ip_ = server_ip; | 103 server_ip_ = server_ip; |
104 server_port_ = server_port; | 104 server_port_ = server_port; |
105 int ret = CreateConnectedSocket( | 105 int ret = CreateTCPClientSocket( |
106 &fd_, server_ip, server_port, true, acceptor_->disable_nagle_); | 106 &fd_, server_ip, server_port, true, acceptor_->disable_nagle_); |
107 | 107 |
108 if (ret < 0) { | 108 if (ret < 0) { |
109 LOG(ERROR) << "-1 Could not create connected socket"; | 109 LOG(ERROR) << "-1 Could not create connected socket"; |
110 return; | 110 return; |
111 } else if (ret == 1) { | 111 } else if (ret == 1) { |
112 DCHECK_NE(-1, fd_); | 112 DCHECK_NE(-1, fd_); |
113 connection_complete_ = true; | 113 connection_complete_ = true; |
114 VLOG(1) << log_prefix_ << ACCEPTOR_CLIENT_IDENT | 114 VLOG(1) << log_prefix_ << ACCEPTOR_CLIENT_IDENT |
115 << "Connection complete to: " << server_ip_ << ":" << server_port_ | 115 << "Connection complete to: " << server_ip_ << ":" << server_port_ |
(...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
652 SMConnection* SMConnection::NewSMConnection(EpollServer* epoll_server, | 652 SMConnection* SMConnection::NewSMConnection(EpollServer* epoll_server, |
653 SSLState* ssl_state, | 653 SSLState* ssl_state, |
654 MemoryCache* memory_cache, | 654 MemoryCache* memory_cache, |
655 FlipAcceptor* acceptor, | 655 FlipAcceptor* acceptor, |
656 std::string log_prefix) { | 656 std::string log_prefix) { |
657 return new SMConnection( | 657 return new SMConnection( |
658 epoll_server, ssl_state, memory_cache, acceptor, log_prefix); | 658 epoll_server, ssl_state, memory_cache, acceptor, log_prefix); |
659 } | 659 } |
660 | 660 |
661 } // namespace net | 661 } // namespace net |
OLD | NEW |