| 5714 | static ActionSink a; |
| 5715 | |
| 5716 | TSVConn |
| 5717 | TSVConnFdCreate(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 | |
| 5754 | TSVIO |
| 5755 | TSVConnReadVIOGet(TSVConn connp) |
no test coverage detected