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

Function SRVR_multi_thread

src/remote/server/server.cpp:1655–1898  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1653
1654
1655void SRVR_multi_thread( rem_port* main_port, USHORT flags)
1656{
1657/**************************************
1658 *
1659 * S R V R _ m u l t i _ t h r e a d
1660 *
1661 **************************************
1662 *
1663 * Functional description
1664 * Multi-threaded flavor of server.
1665 *
1666 **************************************/
1667 server_req_t* request = NULL;
1668 RemPortPtr port; // Was volatile PORT port = NULL;
1669
1670 // hold reference on main_port to free asyncPacket before deletion of port
1671 RemPortPtr mainPortRef(main_port);
1672 PACKET asyncPacket;
1673
1674 zap_packet(&asyncPacket, true);
1675 ++cntServers;
1676
1677 try
1678 {
1679 set_server(main_port, flags);
1680
1681 const size_t MAX_PACKET_SIZE = MAX_SSHORT;
1682 const SSHORT bufSize = MIN(main_port->port_buff_size, MAX_PACKET_SIZE);
1683 UCharBuffer packet_buffer;
1684 UCHAR* const buffer = packet_buffer.getBuffer(bufSize);
1685
1686#ifdef DEV_BUILD
1687#ifndef WIN_NT
1688 if (isatty(2))
1689 {
1690 fprintf(stderr, "Server started successfully\n");
1691 }
1692#endif
1693#endif
1694
1695 // When this loop exits, the server will no longer receive requests
1696 while (true)
1697 {
1698
1699 // We need to have this error handler as there is so much underlaying code
1700 // that is depending on it being there. The expected failure
1701 // that can occur in the call paths from here is out-of-memory
1702 // and it is unknown if other failures can get us here
1703 // Failures can occur from set_server as well as RECEIVE
1704 //
1705 // Note that if a failure DOES occur, we reenter the loop and try to continue
1706 // operations. This is important as this is the main receive loop for
1707 // new incoming requests, if we exit here no new requests can come to the
1708 // server.
1709 try
1710 {
1711 SSHORT dataSize;
1712 // We have a request block - now get some information to stick into it

Callers 3

CLIB_ROUTINE mainFunction · 0.85
WinMainFunction · 0.85
inet_connect_wait_threadFunction · 0.85

Calls 15

set_serverFunction · 0.85
alloc_requestFunction · 0.85
free_requestFunction · 0.85
link_requestFunction · 0.85
fflushFunction · 0.85
iscLogStatusFunction · 0.85
shutdownFunction · 0.85
REMOTE_free_packetFunction · 0.85
select_multiMethod · 0.80
asyncReceiveMethod · 0.80
clearRecvQueMethod · 0.80
getRecvStateMethod · 0.80

Tested by

no test coverage detected