X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/loba.git/blobdiff_plain/57b69c40c630d8240cff989b5c35e449486aab8e..6ff0fa0bf05608ab7edd5e2a5555f7f2eff71da5:/process.cpp diff --git a/process.cpp b/process.cpp index 338f20d..b6afb49 100644 --- a/process.cpp +++ b/process.cpp @@ -227,6 +227,7 @@ void process::send() bind(&process::send1_no_bookkeeping, this, _1)); prev_load_broadcast = load; } + comm.flush(false); } void process::receive(bool wait) @@ -234,7 +235,7 @@ void process::receive(bool wait) message* msg; m_host_t from; - if (may_receive() && comm.recv(msg, from, wait)) { + while (may_receive() && comm.recv(msg, from, wait)) { switch (msg->get_type()) { case message::INFO: { neighbor* n = rev_neigh[from]; @@ -261,7 +262,9 @@ void process::receive(bool wait) break; } delete msg; + wait = false; // only wait on first recv } + comm.flush(false); } void process::finalize1(neighbor& nb) @@ -285,8 +288,10 @@ void process::finalize() DEBUG2("wait for CLOSE from %lu neighbor%s", (unsigned long )neigh.size(), ESSE(neigh.size())); - while (may_receive()) + while (may_receive()) { + comm.flush(false); receive(true); + } comm.flush(true); }