After PR #70, mget will get multi alerts.

This commit is contained in:
Thomas Yuan 2015-08-28 12:27:48 -04:00
parent 2685674eb9
commit a4aa2f9e4b
1 changed files with 12 additions and 6 deletions

View File

@ -300,14 +300,20 @@ int main(int argc, char* argv[])
bootstrap(s);
s.dht_get_item(public_key);
alert* a = wait_for_alert(s, dht_mutable_item_alert::alert_type);
bool authoritative = false;
dht_mutable_item_alert* item = alert_cast<dht_mutable_item_alert>(a);
entry data;
if (item)
data.swap(item->item);
while (!authoritative)
{
alert* a = wait_for_alert(s, dht_mutable_item_alert::alert_type);
printf("%s", data.to_string().c_str());
dht_mutable_item_alert* item = alert_cast<dht_mutable_item_alert>(a);
entry data;
if (item)
data.swap(item->item);
authoritative = item->authoritative;
printf("%s: %s", authoritative ? "auth" : "non-auth", data.to_string().c_str());
}
}
else
{