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

Method sslClientHandShakeEvent

src/iocore/net/SSLNetVConnection.cc:1490–1640  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1488}
1489
1490int
1491SSLNetVConnection::sslClientHandShakeEvent(int &err)
1492{
1493 ssl_error_t ssl_error;
1494
1495 ink_assert(TLSBasicSupport::getInstance(ssl) == this);
1496
1497 // Initialize properly for a client connection
1498 if (this->get_handshake_hook_state() == TLSEventSupport::SSLHandshakeHookState::HANDSHAKE_HOOKS_PRE) {
1499 if (this->pp_info.version != ProxyProtocolVersion::UNDEFINED) {
1500 // Outbound PROXY Protocol
1501 VIO &vio = this->write.vio;
1502 int64_t ntodo = vio.ntodo();
1503 int64_t towrite = vio.get_reader()->read_avail();
1504
1505 if (ntodo > 0 && towrite > 0) {
1506 MIOBufferAccessor &buf = vio.buffer;
1507 int needs = 0;
1508 int64_t total_written = 0;
1509 int64_t r = super::load_buffer_and_write(towrite, buf, total_written, needs);
1510
1511 if (total_written > 0) {
1512 vio.ndone += total_written;
1513 if (vio.ntodo() != 0) {
1514 return SSL_WAIT_FOR_HOOK;
1515 }
1516 }
1517
1518 if (r < 0) {
1519 if (r == -EAGAIN || r == -ENOTCONN || -r == EINPROGRESS) {
1520 return SSL_WAIT_FOR_HOOK;
1521 } else {
1522 return EVENT_ERROR;
1523 }
1524 }
1525 }
1526 }
1527
1528 this->set_handshake_hook_state(TLSEventSupport::SSLHandshakeHookState::HANDSHAKE_HOOKS_OUTBOUND_PRE);
1529 }
1530
1531 // Do outbound hook processing here
1532 // Continue on if we are in the invoked state. The hook has not yet reenabled
1533 if (this->is_invoked_state()) {
1534 return SSL_WAIT_FOR_HOOK;
1535 }
1536
1537 // Go do the preaccept hooks
1538 if (this->get_handshake_hook_state() == TLSEventSupport::SSLHandshakeHookState::HANDSHAKE_HOOKS_OUTBOUND_PRE) {
1539 if (this->invoke_tls_event() == 1) {
1540 return SSL_WAIT_FOR_HOOK;
1541 }
1542 }
1543
1544 ssl_error = this->_ssl_connect();
1545 switch (ssl_error) {
1546 case SSL_ERROR_NONE:
1547 if (dbg_ctl_ssl.on()) {

Callers

nothing calls this directly

Calls 15

_ssl_connectMethod · 0.95
debug_certificate_nameFunction · 0.85
incrementFunction · 0.85
ntodoMethod · 0.80
get_readerMethod · 0.80
is_invoked_stateMethod · 0.80
invoke_tls_eventMethod · 0.80
ats_ip_ntopFunction · 0.50
read_availMethod · 0.45

Tested by

no test coverage detected