MCPcopy Create free account
hub / github.com/RsyncProject/rsync / send_files

Function send_files

sender.c:203–494  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

201}
202
203void send_files(int f_in, int f_out)
204{
205 int fd = -1;
206 struct sum_struct *s;
207 struct map_struct *mbuf = NULL;
208 STRUCT_STAT st;
209 char fname[MAXPATHLEN], xname[MAXPATHLEN];
210 const char *path, *slash;
211 uchar fnamecmp_type;
212 int iflags, xlen;
213 struct file_struct *file;
214 int phase = 0, max_phase = protocol_version >= 29 ? 2 : 1;
215 int itemizing = am_server ? logfile_format_has_i : stdout_format_has_i;
216 enum logcode log_code = log_before_transfer ? FLOG : FINFO;
217 int f_xfer = write_batch < 0 ? batch_fd : f_out;
218 int save_io_error = io_error;
219 int ndx, j;
220
221 if (DEBUG_GTE(SEND, 1))
222 rprintf(FINFO, "send_files starting\n");
223
224 if (whole_file < 0)
225 whole_file = 0;
226
227 progress_init();
228
229 while (1) {
230 if (inc_recurse) {
231 send_extra_file_list(f_out, MIN_FILECNT_LOOKAHEAD);
232 extra_flist_sending_enabled = !flist_eof;
233 }
234
235 /* This call also sets cur_flist. */
236 ndx = read_ndx_and_attrs(f_in, f_out, &iflags, &fnamecmp_type,
237 xname, &xlen);
238 extra_flist_sending_enabled = False;
239
240 if (ndx == NDX_DONE) {
241 if (!am_server && cur_flist) {
242 set_current_file_index(NULL, 0);
243 if (INFO_GTE(PROGRESS, 2))
244 end_progress(0);
245 }
246 if (inc_recurse && first_flist) {
247 file_old_total -= first_flist->used;
248 flist_free(first_flist);
249 if (first_flist) {
250 if (first_flist == cur_flist)
251 file_old_total = cur_flist->used;
252 write_ndx(f_out, NDX_DONE);
253 continue;
254 }
255 }
256 if (++phase > max_phase)
257 break;
258 if (DEBUG_GTE(SEND, 1))
259 rprintf(FINFO, "send_files phase=%d\n", phase);
260 write_ndx(f_out, NDX_DONE);

Callers 2

do_server_senderFunction · 0.85
client_runFunction · 0.85

Calls 15

progress_initFunction · 0.85
send_extra_file_listFunction · 0.85
read_ndx_and_attrsFunction · 0.85
set_current_file_indexFunction · 0.85
end_progressFunction · 0.85
flist_freeFunction · 0.85
write_ndxFunction · 0.85
change_pathnameFunction · 0.85
f_nameFunction · 0.85
recv_xattr_requestFunction · 0.85
maybe_log_itemFunction · 0.85
write_ndx_and_attrsFunction · 0.85

Tested by

no test coverage detected