Debugging note: this will be named read_buf_() when using an external zlib. */
| 1946 | |
| 1947 | /* Debugging note: this will be named read_buf_() when using an external zlib. */ |
| 1948 | void read_buf(int f, char *buf, size_t len) |
| 1949 | { |
| 1950 | if (f != iobuf.in_fd) { |
| 1951 | if (safe_read(f, buf, len) != len) |
| 1952 | whine_about_eof(False); /* Doesn't return. */ |
| 1953 | goto batch_copy; |
| 1954 | } |
| 1955 | |
| 1956 | if (!IN_MULTIPLEXED) { |
| 1957 | raw_read_buf(buf, len); |
| 1958 | total_data_read += len; |
| 1959 | if (forward_flist_data) |
| 1960 | write_buf(iobuf.out_fd, buf, len); |
| 1961 | batch_copy: |
| 1962 | if (f == write_batch_monitor_in) |
| 1963 | safe_write(batch_fd, buf, len); |
| 1964 | return; |
| 1965 | } |
| 1966 | |
| 1967 | while (1) { |
| 1968 | size_t siz; |
| 1969 | |
| 1970 | while (!iobuf.raw_input_ends_before) |
| 1971 | read_a_msg(); |
| 1972 | |
| 1973 | siz = MIN(len, iobuf.raw_input_ends_before - iobuf.in.pos); |
| 1974 | if (siz >= iobuf.in.size) |
| 1975 | siz = iobuf.in.size; |
| 1976 | raw_read_buf(buf, siz); |
| 1977 | total_data_read += siz; |
| 1978 | |
| 1979 | if (forward_flist_data) |
| 1980 | write_buf(iobuf.out_fd, buf, siz); |
| 1981 | |
| 1982 | if (f == write_batch_monitor_in) |
| 1983 | safe_write(batch_fd, buf, siz); |
| 1984 | |
| 1985 | if ((len -= siz) == 0) |
| 1986 | break; |
| 1987 | buf += siz; |
| 1988 | } |
| 1989 | } |
| 1990 | |
| 1991 | void read_sbuf(int f, char *buf, size_t len) |
| 1992 | { |
no test coverage detected