aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/messagebus/locator.cpp
diff options
context:
space:
mode:
authorlonelly <lonelly@yandex-team.ru>2022-02-10 16:49:49 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:49:49 +0300
commitf1a86949d52e1185ed4f05de191b50386abc68f4 (patch)
tree4ab614bf67ba79561cf145781e24d900492a4828 /library/cpp/messagebus/locator.cpp
parent7107d44a6a6d3cd0a7ea831aa0027b2840b17365 (diff)
downloadydb-f1a86949d52e1185ed4f05de191b50386abc68f4.tar.gz
Restoring authorship annotation for <lonelly@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/messagebus/locator.cpp')
-rw-r--r--library/cpp/messagebus/locator.cpp22
1 files changed, 11 insertions, 11 deletions
diff --git a/library/cpp/messagebus/locator.cpp b/library/cpp/messagebus/locator.cpp
index e38a35c426..8d48a30731 100644
--- a/library/cpp/messagebus/locator.cpp
+++ b/library/cpp/messagebus/locator.cpp
@@ -146,8 +146,8 @@ namespace NBus {
RegisterBreak(serviceId, starts[i], addr);
}
return 0;
- }
-
+ }
+
int TBusLocator::RegisterBreak(TServiceId serviceId, const TBusKey start, const TNetAddr& addr) {
TItems::const_iterator it = Items.lower_bound(TItem(serviceId, 0, start, addr));
TItems::const_iterator service_it =
@@ -169,7 +169,7 @@ namespace NBus {
if (start < YBUS_KEYMAX) {
right.Reset(new TItem(serviceId, start + 1, YBUS_KEYMAX, addr));
}
- }
+ }
Items.insert(*left);
Items.insert(*right);
NormalizeBreaks(serviceId);
@@ -182,7 +182,7 @@ namespace NBus {
TServiceId serviceId = GetServiceId(service);
return UnregisterBreak(serviceId, addr);
}
-
+
int TBusLocator::UnregisterBreak(TServiceId serviceId, const TNetAddr& addr) {
int deleted = 0;
TItems::iterator it = Items.begin();
@@ -198,7 +198,7 @@ namespace NBus {
deleted += 1;
}
}
-
+
if (Items.begin() == Items.end()) {
return deleted;
}
@@ -227,13 +227,13 @@ namespace NBus {
}
NormalizeBreaks(serviceId);
- return deleted;
- }
-
+ return deleted;
+ }
+
void TBusLocator::NormalizeBreaks(TServiceId serviceId) {
TItems::const_iterator first = Items.lower_bound(TItem(serviceId, YBUS_KEYMIN, YBUS_KEYMIN, TNetAddr()));
TItems::const_iterator last = Items.end();
-
+
if ((Items.end() != first) && (first->ServiceId == serviceId)) {
if (serviceId != Max<TServiceId>()) {
last = Items.lower_bound(TItem(serviceId + 1, YBUS_KEYMIN, YBUS_KEYMIN, TNetAddr()));
@@ -246,8 +246,8 @@ namespace NBus {
TItem& beg = const_cast<TItem&>(*first);
beg.Addr = last->Addr;
}
- }
-
+ }
+
int TBusLocator::LocateAll(TBusService service, TBusKey key, TVector<TNetAddr>& addrs) {
TGuard<TMutex> G(Lock);
Y_VERIFY(addrs.empty(), "Non emtpy addresses");