MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / aux_connect

Function aux_connect

src/remote/inet.cpp:1476–1599  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1474}
1475
1476static rem_port* aux_connect(rem_port* port, PACKET* packet)
1477{
1478/**************************************
1479 *
1480 * a u x _ c o n n e c t
1481 *
1482 **************************************
1483 *
1484 * Functional description
1485 * Try to establish an alternative connection. Somebody has already
1486 * done a successfull connect request ("packet" contains the response).
1487 *
1488 **************************************/
1489
1490 // If this is a server, we're got an auxiliary connection. Accept it
1491
1492 if (port->port_server_flags)
1493 {
1494 struct timeval timeout;
1495 timeout.tv_sec = port->port_connect_timeout;
1496 timeout.tv_usec = 0;
1497
1498 Select slct;
1499 slct.set(port->port_channel);
1500
1501 int inetErrNo = 0;
1502
1503 while (true)
1504 {
1505 slct.select(&timeout);
1506 const int count = slct.getCount();
1507 inetErrNo = INET_ERRNO;
1508
1509 if (count != -1 || !INTERRUPT_ERROR(inetErrNo))
1510 {
1511 if (count == 1)
1512 break;
1513
1514 const ISC_STATUS error_code =
1515 (count == 0) ? isc_net_event_connect_timeout : isc_net_event_connect_err;
1516 int savedError = inetErrNo;
1517 SOCLOSE(port->port_channel);
1518 inet_error(false, port, "select", error_code, savedError);
1519 }
1520 }
1521
1522 if (port->port_channel == INVALID_SOCKET)
1523 return NULL;
1524
1525 const SOCKET n = os_utils::accept(port->port_channel, NULL, NULL);
1526 inetErrNo = INET_ERRNO;
1527
1528 if (n == INVALID_SOCKET)
1529 {
1530 int savedError = inetErrNo;
1531 SOCLOSE(port->port_channel);
1532 inet_error(false, port, "accept", isc_net_event_connect_err, savedError);
1533 }

Callers

nothing calls this directly

Calls 15

SOCLOSEFunction · 0.85
inet_errorFunction · 0.85
get_peer_infoFunction · 0.85
socketFunction · 0.85
setKeepAliveFunction · 0.85
selectMethod · 0.80
getpeernameMethod · 0.80
auxAcceptErrorMethod · 0.80
setPortMethod · 0.80
portMethod · 0.80
familyMethod · 0.80
acceptFunction · 0.70

Tested by

no test coverage detected