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

Method startEvent

src/iocore/net/Socks.cc:185–235  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

183}
184
185int
186SocksEntry::startEvent(int event, void *data)
187{
188 if (event == NET_EVENT_OPEN) {
189 netVConnection = static_cast<SocksNetVC *>(data);
190
191 if (version == SOCKS5_VERSION) {
192 auth_handler = &socks5BasicAuthHandler;
193 }
194
195 SET_HANDLER(&SocksEntry::mainEvent);
196 mainEvent(NET_EVENT_OPEN, data);
197 } else {
198 if (timeout) {
199 timeout->cancel(this);
200 timeout = nullptr;
201 }
202
203 char buff[INET6_ADDRPORTSTRLEN];
204 Dbg(dbg_ctl_Socks, "Failed to connect to %s", ats_ip_nptop(&server_addr.sa, buff, sizeof(buff)));
205
206 findServer();
207
208 if (!ats_is_ip(&server_addr)) {
209 Dbg(dbg_ctl_Socks, "Unable to open connection to the SOCKS server");
210 lerrno = ESOCK_NO_SOCK_SERVER_CONN;
211 free();
212 return EVENT_CONT;
213 }
214
215 if (timeout) {
216 timeout->cancel(this);
217 timeout = nullptr;
218 }
219
220 if (netVConnection) {
221 netVConnection->do_io_close();
222 netVConnection = nullptr;
223 }
224
225 timeout = this_ethread()->schedule_in(this, HRTIME_SECONDS(netProcessor.socks_conf_stuff->server_connect_timeout));
226
227 write_done = false;
228
229 NetVCOptions options;
230 options.socks_support = NO_SOCKS;
231 netProcessor.connect_re(this, &server_addr.sa, options);
232 }
233
234 return EVENT_CONT;
235}
236
237int
238SocksEntry::mainEvent(int event, void *data)

Callers

nothing calls this directly

Calls 7

ats_is_ipFunction · 0.85
this_ethreadFunction · 0.85
ats_ip_nptopFunction · 0.50
cancelMethod · 0.45
do_io_closeMethod · 0.45
schedule_inMethod · 0.45
connect_reMethod · 0.45

Tested by

no test coverage detected