flist = flist_new(0, "send_extra_file_list");
start_write = stats.total_written;
- write_int(f, NDX_FLIST_OFFSET - send_dir_ndx);
+ write_ndx(f, NDX_FLIST_OFFSET - send_dir_ndx);
change_local_filter_dir(fbuf, dlen, send_dir_depth);
send_directory(f, flist, send_dir_ndx, fbuf, dlen, FLAG_DIVERT_DIRS | FLAG_XFER_DIR);
write_byte(f, 0);
} else {
while (DIR_NEXT_SIBLING(dp) < 0) {
if ((send_dir_ndx = DIR_PARENT(dp)) < 0) {
- write_int(f, NDX_FLIST_EOF);
+ write_ndx(f, NDX_FLIST_EOF);
flist_eof = 1;
change_local_filter_dir(NULL, 0, 0);
goto finish;
* was just 1 item in the first file-list, send 1 more
* file-list to check if this is a 1-file xfer. */
if (send_dir_ndx < 0)
- write_int(f, NDX_DONE);
+ write_ndx(f, NDX_DONE);
else
send_extra_file_list(f, 1);
}
void recv_additional_file_list(int f)
{
struct file_list *flist;
- int ndx = read_int(f);
+ int ndx = read_ndx(f);
if (ndx == NDX_DONE) {
flist_eof = 1;
change_local_filter_dir(NULL, 0, 0);
|| stdout_format_has_i > 1 || (xname && *xname)) && !read_batch) {
if (protocol_version >= 29) {
if (ndx >= 0)
- write_int(sock_f_out, ndx + cur_flist->ndx_start);
+ write_ndx(sock_f_out, ndx + cur_flist->ndx_start);
write_shortint(sock_f_out, iflags);
if (iflags & ITEM_BASIS_TYPE_FOLLOWS)
write_byte(sock_f_out, fnamecmp_type);
if (preserve_hard_links && F_IS_HLINKED(file))
file->flags |= FLAG_FILE_SENT;
#endif
- write_int(f_out, ndx + cur_flist->ndx_start);
+ write_ndx(f_out, ndx + cur_flist->ndx_start);
if (itemizing) {
int iflags = ITEM_TRANSFER;
if (always_checksum > 0)
phase);
}
- write_int(f_out, NDX_DONE);
+ write_ndx(f_out, NDX_DONE);
}
csum_length = SUM_LENGTH;
}
}
- flist_free(cur_flist);
+ flist_free(first_flist); /* updates cur_flist & first_flist */
if (!read_batch)
- write_int(f_out, NDX_DONE);
+ write_ndx(f_out, NDX_DONE);
}
} while ((cur_flist = next_flist) != NULL);
if (verbose > 2)
rprintf(FINFO, "generate_files phase=%d\n", phase);
- write_int(f_out, NDX_DONE);
+ write_ndx(f_out, NDX_DONE);
/* Reduce round-trip lag-time for a useless delay-updates phase. */
if (protocol_version >= 29 && !delay_updates)
- write_int(f_out, NDX_DONE);
+ write_ndx(f_out, NDX_DONE);
/* Read MSG_DONE for the redo phase (and any prior messages). */
while (done_cnt <= 1) {
if (verbose > 2)
rprintf(FINFO, "generate_files phase=%d\n", phase);
if (delay_updates)
- write_int(f_out, NDX_DONE);
+ write_ndx(f_out, NDX_DONE);
/* Read MSG_DONE for delay-updates phase & prior messages. */
while (done_cnt == 2)
wait_for_receiver();
io_flush(FULL_FLUSH);
if (protocol_version >= 24) {
/* send a final goodbye message */
- write_int(f_out, NDX_DONE);
+ write_ndx(f_out, NDX_DONE);
}
io_flush(FULL_FLUSH);
read_loop:
while (1) {
- ndx = read_int(f_in);
+ ndx = read_ndx(f_in);
if (ndx >= 0)
break;
void write_ndx_and_attrs(int f_out, int ndx, int iflags,
uchar fnamecmp_type, char *buf, int len)
{
- write_int(f_out, ndx);
+ write_ndx(f_out, ndx);
if (protocol_version < 29)
return;
write_shortint(f_out, iflags);
if (incremental && first_flist) {
flist_free(first_flist);
if (first_flist) {
- write_int(f_out, NDX_DONE);
+ write_ndx(f_out, NDX_DONE);
continue;
}
}
break;
if (verbose > 2)
rprintf(FINFO, "send_files phase=%d\n", phase);
- write_int(f_out, NDX_DONE);
+ write_ndx(f_out, NDX_DONE);
continue;
}
match_report();
- write_int(f_out, NDX_DONE);
+ write_ndx(f_out, NDX_DONE);
}