Beispiel #1
0
// the host has failed
//
void HOST::handle() {
    set<HOST*>::iterator i = hosts.find(this);
    hosts.erase(i);

#ifdef EVENT_DEBUG
    printf("%s: host %d failed\n", now_str(), id);
#endif
    set<CHUNK_ON_HOST*>::iterator p;
    for (p = chunks.begin(); p != chunks.end(); p++) {
        CHUNK_ON_HOST* c = *p;
        c->chunk->host_failed(c);
        if (c->transfer_in_progress) {
            sim.remove(c);
        }
        delete c;
    }
}
Beispiel #2
0
void CHUNK_ON_HOST::remove() {
    if (transfer_in_progress) {
        sim.remove(this);
        if (!transfer_wait) {
            if (present_on_host) {
                chunk->parent->dfile->upload_rate.sample_inc(
                    -host->transfer_rate,
                    chunk->parent->dfile->collecting_stats(),
                    sim.now
                );
            } else {
                chunk->parent->dfile->download_rate.sample_inc(
                    -host->transfer_rate,
                    chunk->parent->dfile->collecting_stats(),
                    sim.now
                );
            }
        }
    }
}