| true | 1789 | | mxfer(txup, tmout) | | | 1790 | | struct pmsg *txup; | | | 1791 | | struct timeval *tmout; | | | 1792 | | { | | | 1793 | | struct ttpcb *txpcbp = 0; | | | 1794 | | struct frag *txfp = 0; | | | 1795 | | struct timeval tin; | | | 1796 | | struct timeval tnow; | | | 1797 | | struct timeval *tvp; | | | 1798 | | #ifdef FDSETNOTSTRUCT | | | 1799 | | fd_set rfds, wfds; | | | 1800 | | #else | | | 1801 | | struct fd_set rfds, wfds; | | | 1802 | | #endif | | | 1803 | | int wantmore = 1; | | | 1804 | | int gotem = 0; | | | 1805 | | int ff; | | | 1806 | | int n; | | | 1807 | | #ifdef SOCKLENISUINT | | | 1808 | | #if defined(IMA_AIX4SP2) || defined(IMA_AIX5SP2) | | | 1809 | | unsigned int oslen; | | | 1810 | | #else | | | 1811 | | size_t oslen; | | | 1812 | | #endif | | | 1813 | | #else | | | 1814 | | int oslen; | | | 1815 | | #endif | | | 1816 | | char *txcp = 0; | | | 1817 | | int txtogo = 0; | | | 1818 | | struct sockaddr_in sad; | | | 1819 | | int s; | | | 1820 | | struct ttpcb *pcbp; | | | 1821 | | char * = (char *) NULL;
| | | 1822 | | int inPlaceBodyLen = 0; | | | 1823 | | int bypassRead = FALSE;
| | | 1824 | | int waitForOgmToComplete = FALSE;
| | | 1825 | | int probedForIncomingPkts = FALSE;
| | | 1826 | | struct msgid *sendmsg = (struct msgid *) NULL;
| | | 1827 | | char errtxt[64]; | | | 1828 | | | | | 1829 | | int nfr = 0, totfr = 0; | | | 1830 | | int probe = 0; | | | 1831 | | | | | 1832 | | if (tmout) | | | 1833 | | { | | | 1834 | | pvmgetclock(&tin); | | | 1835 | | probe = ( tmout -> tv_sec == 0 && tmout -> tv_usec == 0); | | | 1836 | | } | | | 1837 | | | | | 1838 | | if (txup) { | | | 1839 | | txfp = txup->m_frag->fr_link; | | | 1840 | | if (!txfp->fr_buf) { | | | 1841 | | if (!(txfp = fr_new(MAXHDR)))
| | | 1842 | | return PvmNoMem;
| | | 1843 | | txfp->fr_dat += MAXHDR;
| | | 1844 | | LISTPUTBEFORE(txup->m_frag, txfp, fr_link, fr_rlink);
| | | 1845 | | } | | | 1846 | | | | | 1847 | | if (!(txpcbp = ttpcb_find(txup->m_dst)) || txpcbp->tt_state != TTOPEN)
| | | 1848 | | txpcbp = topvmd; | | | 1849 | | txup->m_ref++; | | | 1850 | | bypassRead = TRUE;
| | | 1851 | | } | | | 1852 | | | | | 1853 | | if (pvmdebmask & PDMMESSAGE) {
| | | 1854 | | pvmlogprintf("mxfer() mid %d", (txup ? txup->m_mid : 0)); | | | 1855 | | if (txup) | | | 1856 | | pvmlogprintf(" ctx %d tag %s dst t%x route t%x", | | | 1857 | | txup->m_ctx, | | | 1858 | | pvmnametag(txup->m_tag, (int *)0), | | | 1859 | | txup->m_dst, txpcbp->tt_tid); | | | 1860 | | if (tmout) | | | 1861 | | pvmlogprintf(" tmout %d.%06d\n", | | | 1862 | | tmout->tv_sec, tmout->tv_usec); | | | 1863 | | else | | | | | ... | | | 1872 | | | | | 1873 | | | | | 1874 | | | | | 1875 | | | | | 1876 | | | | | 1877 | | | | | 1878 | | | | | 1879 | | | | | 1880 | | | | | 1881 | | | | | 1882 | | while (txfp || topvmd->tt_rxf || wantmore || waitForOgmToComplete | | | 1883 | | || !probedForIncomingPkts | | | 1884 | | ) | | | 1885 | | { | | | 1886 | | | | | 1887 | | totfr = 0; | | | 1888 | | | | | 1889 | | | | | 1890 | | if (txfp || topvmd->tt_rxf) | | | 1891 | | { | | | 1892 | | | | | 1893 | | tvp = (struct timeval *) NULL;
| | | 1894 | | | | | 1895 | | } | | | 1896 | | else | | | 1897 | | { | | | 1898 | | if (wantmore) | | | 1899 | | { | | | 1900 | | | | | 1901 | | | | | 1902 | | | | | 1903 | | | | | 1904 | | | | | 1905 | | | | | 1906 | | if (tmout) | | | 1907 | | { | | | 1908 | | pvmgetclock(&tnow); | | | 1909 | | TVXSUBY(&tnow, &tnow, &tin);
| | | 1910 | | if (TVXLTY(tmout, &tnow))
| | | 1911 | | { | | | 1912 | | TVCLEAR(&tnow);
| | | 1913 | | wantmore = 0; | | | 1914 | | } | | | 1915 | | else | | | 1916 | | { | | | 1917 | | TVXSUBY(&tnow, tmout, &tnow);
| | | 1918 | | } | | | 1919 | | tvp = &tnow; | | | 1920 | | } | | | 1921 | | else | | | 1922 | | { | | | 1923 | | tvp = (struct timeval *) NULL;
| | | 1924 | | } | | | 1925 | | | | | 1926 | | } | | | 1927 | | else | | | 1928 | | { | | | 1929 | | TVCLEAR(&tnow);
| | | 1930 | | tvp = &tnow; | | | 1931 | | } | | | 1932 | | } | | | 1933 | | | | | 1934 | | | | | 1935 | | | | | 1936 | | | | | 1937 | | | | | 1938 | | | | | 1939 | | #if !defined(IMA_MPP) | | | 1940 | | rfds = pvmrfds; | | | 1941 | | FD_ZERO(&wfds);
| | | 1942 | | if (txfp) | | | 1943 | | FD_SET(txpcbp->tt_fd, &wfds);
| | | 1944 | | #endif | | | 1945 | | | | | 1946 | | if (pvmdebmask & PDMSELECT) {
| | | 1947 | | if (tvp) | | | 1948 | | pvmlogprintf("mxfer() select timeout %d.%06d\n", | | | 1949 | | tvp->tv_sec, tvp->tv_usec); | | | 1950 | | else | | | 1951 | | pvmlogprintf("mxfer() select timeout inf\n"); | | | 1952 | | #if !defined(IMA_MPP) | | | 1953 | | print_fdset("mxfer() rfds=", pvmnfds, &rfds); |
| | 368 | | | | | | | | vpvmlogprintf(fmt, ap) | | | 369 | | | | | | | | char *fmt; | | | 370 | | | | | | | | va_list ap; | | | 371 | | | | | | | | { | | | 372 | | | | | | | | char vtmp[1024]; | | | 373 | | | | | | | | char *truncated; | | | 374 | | | | | | | | int cnt = 0; | | | 375 | | | | | | | | int cc; | | | 376 | | | | | | | | | | | 377 | | | | | | | | #ifdef TIMESTAMPLOG | | | 378 | | | | | | | | time_t now; | | | 379 | | | | | | | | struct tm *tmp; | | | 380 | | | | | | | | | | | 381 | | | | | | | | time(&now); | | | 382 | | | | | | | | tmp = localtime(&now); | | | 383 | | | | | | | | #endif | | | 384 | | | | | | | | | | | 385 | | | | | | | | | | | 386 | | | | | | | | | | | 387 | | | | | | | | | | | 388 | | | | | | | | | | | 389 | | | | | | | | | | | 390 | | | | | | | | cc = vsnprintf(vtmp, sizeof(vtmp), fmt, ap); | | | 391 | | | | | | | | truncated = ( cc >= 0 && cc < sizeof(vtmp) ) | | | 392 | | | | | | | | ? "" : "[...]\n"; | | | 393 | | | | | | | | | | | 394 | | | | | | | | if (log_how & 1) { | | | 395 | | | | | | | | if (atnewline) { | | | 396 | | | | | | | | if (pvmmytid) | | | 397 | | | | | | | | fprintf(stderr, "[t%x] ", pvmmytid); | | | 398 | | | | | | | | else | | | 399 | | | | | | | | fprintf(stderr, "[pvmd pid%d] ", pvmmyupid); | | | 400 | | | | | | | | | | | 401 | | | | | | | | #ifdef TIMESTAMPLOG | | | 402 | | | | | | | | fprintf(stderr, "%02d/%02d %02d:%02d:%02d ", | | | 403 | | | | | | | | tmp->tm_mon + 1, | | | 404 | | | | | | | | tmp->tm_mday, | | | | | | | | | | | ... | | | 406 | | | | | | | | tmp->tm_min, | | | 407 | | | | | | | | tmp->tm_sec); | | | 408 | | | | | | | | #endif | | | 409 | | | | | | | | } | | | 410 | | | | | | | | | | | 411 | | | | | | | | cc = fprintf(stderr, "%s%s", vtmp, truncated); | | | 412 | | | | | | | | cnt = ( cc >= 0 ) ? cnt + cc : cc; | | | 413 | | | | | | | | fflush(stderr); | | | 414 | | | | | | | | } | | | 415 | | | | | | | | | | | 416 | | | | | | | | if (log_how & 2) { | | | 417 | | | | | | | | if (log_alrdy < pvmdlogmax) { | | | 418 | | | | | | | | if (atnewline) { | | | 419 | | | | | | | | if (pvmmytid) | | | 420 | | | | | | | | fprintf(log_ff, "[t%x] ", pvmmytid); | | | 421 | | | | | | | | else | | | 422 | | | | | | | | fprintf(log_ff, "[pvmd pid%d] ", pvmmyupid); | | | 423 | | | | | | | | | | | 424 | | | | | | | | #ifdef TIMESTAMPLOG | | | 425 | | | | | | | | fprintf(log_ff, "%02d/%02d %02d:%02d:%02d ", | | | 426 | | | | | | | | tmp->tm_mon + 1, | | | | | | | | | | | ... | | | 434 | | | | | | | | | | | 435 | | | | | | | | cc = fprintf(log_ff, "%s%s", vtmp, truncated); | | | 436 | | | | | | | | cnt = ( cnt >= 0 ) ? ( ( cc >= 0 ) ? cnt + cc : cc ) : cnt; | | | 437 | | | | | | | | fflush(log_ff); | | | 438 | | | | | | | | | | | 439 | | | | | | | | if ((log_alrdy += cnt) >= pvmdlogmax) | | | 440 | | | | | | | | (void)write(log_fd, toomuch, strlen(toomuch)); | | | 441 | | | | | | | | } | | | 442 | | | | | | | | } | | | 443 | | | | | | | | | | | 444 | | | | | | | | atnewline = (fmt[strlen(fmt) - 1] == '\n') ? 1 : 0; | | | 445 | | | | | | | | | | | 446 | | | | | | | | | | | 447 | | | | | | | | | | | 448 | | | | | | | | | | | 449 | | | | | | | | | | | 450 | | | | | | | | | | | 451 | | | | | | | | | | | 452 | | | | | | | | return(cnt); | | wfds is uninitialized | 453 | | | | | | | | } |
|