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

Method x_putbytes

src/remote/os/win32/xnet.cpp:1831–1942  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1829
1830
1831bool_t XnetXdr::x_putbytes(const SCHAR* buff, unsigned bytecount)
1832{
1833/**************************************
1834 *
1835 * x n e t _ p u t b y t e s
1836 *
1837 **************************************
1838 *
1839 * Functional description
1840 * Put a bunch of bytes into a memory stream.
1841 *
1842 **************************************/
1843 rem_port* port = x_public;
1844 const bool portServer = (port->port_flags & PORT_server);
1845 XCC xcc = port->port_xcc;
1846 XCH xch = xcc->xcc_send_channel;
1847 XPM xpm = xcc->xcc_xpm;
1848 XPS xps = (XPS) xcc->xcc_mapped_addr;
1849
1850 while (bytecount && !xnet_shutdown)
1851 {
1852 if (!portServer && (xpm->xpm_flags & XPMF_SERVER_SHUTDOWN))
1853 {
1854 if (!(xcc->xcc_flags & XCCF_SERVER_SHUTDOWN))
1855 {
1856 xcc->xcc_flags |= XCCF_SERVER_SHUTDOWN;
1857 xnet_error(port, isc_lost_db_connection, 0);
1858 }
1859 return FALSE;
1860 }
1861
1862 SLONG to_copy;
1863 if (x_handy >= bytecount)
1864 to_copy = bytecount;
1865 else
1866 to_copy = x_handy;
1867
1868 if (x_handy)
1869 {
1870 if (x_handy == xch->xch_size)
1871 {
1872 while (!xnet_shutdown)
1873 {
1874 if (!portServer && (xpm->xpm_flags & XPMF_SERVER_SHUTDOWN))
1875 {
1876 if (!(xcc->xcc_flags & XCCF_SERVER_SHUTDOWN))
1877 {
1878 xcc->xcc_flags |= XCCF_SERVER_SHUTDOWN;
1879 xnet_error(port, isc_lost_db_connection, 0);
1880 }
1881 return FALSE;
1882 }
1883
1884 const DWORD wait_result =
1885 WaitForSingleObject(xcc->xcc_event_send_channel_empted,
1886 XNET_SEND_WAIT_TIMEOUT);
1887
1888 if (wait_result == WAIT_OBJECT_0) {

Callers

nothing calls this directly

Calls 3

xnet_errorFunction · 0.85
xnet_writeFunction · 0.85
server_shutdownMethod · 0.80

Tested by

no test coverage detected