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

Function TSVConnFdCreate

src/api/InkAPI.cc:5716–5752  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5714static ActionSink a;
5715
5716TSVConn
5717TSVConnFdCreate(int fd)
5718{
5719 UnixNetVConnection *vc;
5720 EThread *t = this_ethread();
5721
5722 if (unlikely(fd == NO_FD)) {
5723 return nullptr;
5724 }
5725
5726 vc = static_cast<UnixNetVConnection *>(netProcessor.allocate_vc(t));
5727 if (vc == nullptr) {
5728 return nullptr;
5729 }
5730
5731 // We need to set an Action to handle NET_EVENT_OPEN* events. Since we have a
5732 // socket already, we don't need to do anything in those events, so we can just
5733 // sink them. It's better to sink them here, than to make the NetVC code more
5734 // complex.
5735 vc->action_ = &a;
5736
5737 vc->id = net_next_connection_number();
5738 vc->submit_time = ink_get_hrtime();
5739 vc->mutex = new_ProxyMutex();
5740 vc->set_is_transparent(false);
5741 vc->set_context(NetVConnectionContext_t::NET_VCONNECTION_OUT);
5742
5743 // We should take the nh's lock and vc's lock before we get into the connectUp
5744 SCOPED_MUTEX_LOCK(lock, get_NetHandler(t)->mutex, t);
5745 SCOPED_MUTEX_LOCK(lock2, vc->mutex, t);
5746
5747 if (vc->connectUp(t, fd) != CONNECT_SUCCESS) {
5748 return nullptr;
5749 }
5750
5751 return reinterpret_cast<TSVConn>(vc);
5752}
5753
5754TSVIO
5755TSVConnReadVIOGet(TSVConn connp)

Callers 2

InterceptInterceptHookFunction · 0.85
xMethod · 0.85

Calls 9

this_ethreadFunction · 0.85
ink_get_hrtimeFunction · 0.85
new_ProxyMutexFunction · 0.85
get_NetHandlerFunction · 0.85
set_is_transparentMethod · 0.80
allocate_vcMethod · 0.45
set_contextMethod · 0.45
connectUpMethod · 0.45

Tested by

no test coverage detected