MCPcopy Create free account
hub / github.com/apache/trafficserver / new_connection

Method new_connection

src/proxy/http/Http1ClientSession.cc:141–223  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

139}
140
141void
142Http1ClientSession::new_connection(NetVConnection *new_vc, MIOBuffer *iobuf, IOBufferReader *reader)
143{
144 ink_assert(new_vc != nullptr);
145 ink_assert(_vc == nullptr);
146 _vc = new_vc;
147 magic = HTTP_CS_MAGIC_ALIVE;
148 mutex = new_vc->mutex;
149 trans.mutex = mutex; // Share this mutex with the transaction
150 in_destroy = false;
151
152 if (TLSEarlyDataSupport *eds = new_vc->get_service<TLSEarlyDataSupport>()) {
153 read_from_early_data = eds->get_early_data_len();
154 Dbg(dbg_ctl_ssl_early_data, "read_from_early_data = %" PRId64, read_from_early_data);
155 }
156
157 MUTEX_TRY_LOCK(lock, mutex, this_ethread());
158 ink_assert(lock.is_locked());
159
160 // Unique client session identifier.
161 con_id = ProxySession::next_connection_id();
162
163 schedule_event = nullptr;
164
165 Metrics::Gauge::increment(http_rsb.current_client_connections);
166 conn_decrease = true;
167 Metrics::Counter::increment(http_rsb.total_client_connections);
168 if (static_cast<HttpProxyPort::TransportType>(new_vc->attributes) == HttpProxyPort::TRANSPORT_SSL) {
169 Metrics::Counter::increment(http_rsb.https_total_client_connections);
170 }
171
172 /* inbound requests stat should be incremented here, not after the
173 * header has been read */
174 Metrics::Counter::increment(http_rsb.total_incoming_connections);
175
176 // check what type of socket address we just accepted
177 // by looking at the address family value of sockaddr_storage
178 // and logging to stat system
179 switch (new_vc->get_remote_addr()->sa_family) {
180 case AF_INET:
181 Metrics::Counter::increment(http_rsb.total_client_connections_ipv4);
182 break;
183 case AF_INET6:
184 Metrics::Counter::increment(http_rsb.total_client_connections_ipv6);
185 break;
186 case AF_UNIX:
187 Metrics::Counter::increment(http_rsb.total_client_connections_uds);
188 break;
189 default:
190 // don't do anything if the address family is not ipv4, ipv6, or unix domain socket
191 // (there are many other address families in <sys/socket.h>
192 // but we don't have a need to report on all the others today)
193 break;
194 }
195
196#ifdef USE_HTTP_DEBUG_LISTS
197 ink_mutex_acquire(&debug_cs_list_mutex);
198 debug_cs_list.push(this);

Callers

nothing calls this directly

Calls 11

this_ethreadFunction · 0.85
incrementFunction · 0.85
ink_mutex_acquireFunction · 0.85
ink_mutex_releaseFunction · 0.85
get_early_data_lenMethod · 0.80
alloc_readerMethod · 0.80
get_remote_addrMethod · 0.45
pushMethod · 0.45
set_readerMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected