timeout and tox2
This commit is contained in:
parent
044a640c13
commit
0f35249df1
@ -102,7 +102,8 @@ class ToxService {
|
||||
DHT_node nodes[] =
|
||||
{
|
||||
// own bootsrap node, to reduce load
|
||||
{"tox.plastiras.org", 33445, "8E8B63299B3D520FB377FE5100E65E3322F7AE5B20A0ACED2981769FC5B43725", {}}, // 14
|
||||
//{"tox.plastiras.org", 33445, "8E8B63299B3D520FB377FE5100E65E3322F7AE5B20A0ACED2981769FC5B43725", {}}, // 14
|
||||
{"tox2.plastiras.org", 33445, "B6626D386BE7E3ACA107B46F48A5C4D522D29281750D44A0CBA6A2721E79C951", {}}, // 14
|
||||
};
|
||||
|
||||
for (size_t i = 0; i < sizeof(nodes)/sizeof(DHT_node); i ++) {
|
||||
|
@ -62,6 +62,20 @@ class ToxServiceSender : public ToxService {
|
||||
continue;
|
||||
}
|
||||
|
||||
{ // do timeout
|
||||
const uint32_t timeout {1000000}; // 1sec
|
||||
auto time_stamp_now = get_microseconds();
|
||||
|
||||
for (auto it = _pkg_info.begin(); it != _pkg_info.end();) {
|
||||
if (time_stamp_now - it->second.time_stamp >= timeout) {
|
||||
std::cout << "pkg " << it->first << " timed out!\n";
|
||||
it = _pkg_info.erase(it);
|
||||
} else {
|
||||
it++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (_window > _pkg_info.size()) { // can send
|
||||
// 192-254 for lossy
|
||||
const size_t max_pkg_size = 1024 + 1;
|
||||
|
Loading…
Reference in New Issue
Block a user