int ignore_timeout = 0;
int batch_fd = -1;
int msgdone_cnt = 0;
-int check_for_io_err = 0;
/* Ignore an EOF error if non-zero. See whine_about_eof(). */
int kluge_around_eof = 0;
static void writefd_unbuffered(int fd, const char *buf, size_t len);
static void mplex_write(int fd, enum msgcode code, const char *buf, size_t len, int convert);
-struct flist_ndx_item {
- struct flist_ndx_item *next;
- int ndx;
-};
-
-struct flist_ndx_list {
- struct flist_ndx_item *head, *tail;
-};
-
-static struct flist_ndx_list redo_list, hlink_list;
+static flist_ndx_list redo_list, hlink_list;
struct msg_list_item {
struct msg_list_item *next;
static struct msg_list msg_queue;
-static void flist_ndx_push(struct flist_ndx_list *lp, int ndx)
-{
- struct flist_ndx_item *item;
-
- if (!(item = new(struct flist_ndx_item)))
- out_of_memory("flist_ndx_push");
- item->next = NULL;
- item->ndx = ndx;
- if (lp->tail)
- lp->tail->next = item;
- else
- lp->head = item;
- lp->tail = item;
-}
-
-static int flist_ndx_pop(struct flist_ndx_list *lp)
-{
- struct flist_ndx_item *next;
- int ndx;
-
- if (!lp->head)
- return -1;
-
- ndx = lp->head->ndx;
- next = lp->head->next;
- free(lp->head);
- lp->head = next;
- if (!next)
- lp->tail = NULL;
-
- return ndx;
-}
-
static void got_flist_entry_status(enum festatus status, const char *buf)
{
int ndx = IVAL(buf, 0);
}
break;
case FES_REDO:
+ if (read_batch) {
+ if (inc_recurse)
+ flist->in_progress++;
+ break;
+ }
if (inc_recurse)
flist->to_redo++;
flist_ndx_push(&redo_list, ndx);
len = tag & 0xFFFFFF;
tag = (tag >> 24) - MPLEX_BASE;
- check_for_io_err = 0;
-
switch (tag) {
case MSG_DONE:
if (len < 0 || len > 1 || !am_generator) {
}
flist = recv_file_list(fd);
flist->parent_ndx = IVAL(buf,0);
- /* If the sender is going to send us an MSG_IO_ERROR value, it
- * will always be the very next message following MSG_FLIST. */
- check_for_io_err = 1;
#ifdef SUPPORT_HARD_LINKS
if (preserve_hard_links)
match_hard_links(flist);
* this, sender-side deletions were mostly happening at the end. */
void increment_active_files(int ndx, int itemizing, enum logcode code)
{
- /* TODO: tune these limits? */
- while (active_filecnt >= (active_bytecnt >= 128*1024 ? 10 : 50)) {
+ while (1) {
+ /* TODO: tune these limits? */
+ int limit = active_bytecnt >= 128*1024 ? 10 : 50;
+ if (active_filecnt < limit)
+ break;
check_for_finished_files(itemizing, code, 0);
+ if (active_filecnt < limit)
+ break;
if (iobuf_out_cnt)
io_flush(NORMAL_FLUSH);
else
void wait_for_receiver(void)
{
- if (io_flush(FULL_FLUSH))
+ if (io_flush(NORMAL_FLUSH))
return;
read_msg_fd();
}
msg_bytes = tag & 0xFFFFFF;
tag = (tag >> 24) - MPLEX_BASE;
- check_for_io_err = 0;
-
switch (tag) {
case MSG_DATA:
if (msg_bytes > iobuf_in_siz) {