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

Function state_connect_to_server

example/plugins/c-api/protocol/TxnSM.cc:509–531  ·  view source on GitHub ↗

Net Processor calls back, if succeeded, the net_vc is returned. Note here, even if the event is TS_EVENT_NET_CONNECT, it doesn't mean the net connection is set up because TSNetConnect is non-blocking. Do VConnWrite to the net_vc, if fails, that means there is no net connection. */

Source from the content-addressed store, hash-verified

507 Do VConnWrite to the net_vc, if fails, that means there is no net
508 connection. */
509int
510state_connect_to_server(TSCont contp, TSEvent event, TSVConn vc)
511{
512 TxnSM *txn_sm = static_cast<TxnSM *>(TSContDataGet(contp));
513
514 Dbg(dbg_ctl, "enter state_connect_to_server");
515
516 /* TSNetConnect failed. */
517 if (event != TS_EVENT_NET_CONNECT) {
518 return prepare_to_die(contp);
519 }
520 txn_sm->q_pending_action = nullptr;
521
522 txn_sm->q_server_vc = vc;
523
524 /* server_vc will be used to write request and read response. */
525 set_handler(txn_sm->q_current_handler, (TxnSMHandler)&state_send_request_to_server);
526
527 /* Actively write the request to the net_vc. */
528 txn_sm->q_server_write_vio =
529 TSVConnWrite(txn_sm->q_server_vc, contp, txn_sm->q_server_request_buffer_reader, strlen(txn_sm->q_client_request));
530 return TS_SUCCESS;
531}
532
533/* Net Processor calls back, if write complete, wait for the response
534 coming in, otherwise, reenable the write_vio. */

Callers

nothing calls this directly

Calls 3

TSContDataGetFunction · 0.85
prepare_to_dieFunction · 0.85
TSVConnWriteFunction · 0.85

Tested by

no test coverage detected