indexer: kill git_indexer_stats.data_received

It's not really needed with the current code as we have EOS and the
sideband's flush to tell us we're done.

Keep the distinction between processed and received objects.
This commit is contained in:
Carlos Martín Nieto 2012-08-26 00:35:52 +02:00
parent cc1d85d1da
commit 2b175ca972
3 changed files with 4 additions and 19 deletions

View File

@ -20,7 +20,6 @@ typedef struct git_indexer_stats {
unsigned int total; unsigned int total;
unsigned int processed; unsigned int processed;
unsigned int received; unsigned int received;
unsigned int data_received;
} git_indexer_stats; } git_indexer_stats;

View File

@ -306,10 +306,7 @@ static int no_sideband(git_indexer_stream *idx, gitno_buffer *buf, git_off_t *by
return -1; return -1;
*bytes += recvd; *bytes += recvd;
} while(recvd > 0 && stats->data_received); } while(recvd > 0);
if (!stats->data_received)
giterr_set(GITERR_NET, "Early EOF while downloading packfile");
if (git_indexer_stream_finalize(idx, stats)) if (git_indexer_stream_finalize(idx, stats))
return -1; return -1;
@ -374,13 +371,10 @@ int git_fetch__download_pack(
git__free(pkt); git__free(pkt);
break; break;
} }
} while (!stats->data_received); } while (1);
if (!stats->data_received) if (git_indexer_stream_finalize(idx, stats) < 0)
giterr_set(GITERR_NET, "Early EOF while downloading packfile"); goto on_error;
if (git_indexer_stream_finalize(idx, stats))
return -1;
git_indexer_stream_free(idx); git_indexer_stream_free(idx);
return 0; return 0;

View File

@ -383,14 +383,6 @@ int git_indexer_stream_add(git_indexer_stream *idx, const void *data, size_t siz
stats->received++; stats->received++;
} }
/*
* If we've received all of the objects and our packfile is
* one hash beyond the end of the last object, all of the
* packfile is here.
*/
if (stats->received == idx->nr_objects && idx->pack->mwf.size >= idx->off + 20)
stats->data_received = 1;
return 0; return 0;
on_error: on_error: