diff options
Diffstat (limited to 'src/nostr.cpp')
| -rw-r--r-- | src/nostr.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/nostr.cpp b/src/nostr.cpp index 21104bc..6d85bf6 100644 --- a/src/nostr.cpp +++ b/src/nostr.cpp | |||
| @@ -110,6 +110,12 @@ vector<string> vBtfMeetingRelays = { | |||
| 110 | "31.44.4.249:8434", // New Jersey, US | 110 | "31.44.4.249:8434", // New Jersey, US |
| 111 | "90.156.222.107:8434", // Almaty, KZ | 111 | "90.156.222.107:8434", // Almaty, KZ |
| 112 | }; | 112 | }; |
| 113 | // True when the operator pinned the relay list with /rvrelay: discovered | ||
| 114 | // relays must NOT be merged in (BtfAllRelays), otherwise one accept thread | ||
| 115 | // per discovered relay is spawned and each one optimistically overwrites the | ||
| 116 | // advertised meeting node (BtfSetActiveRelay) before registering -- a | ||
| 117 | // discovered but unreachable relay then flaps the published .btf descriptor. | ||
| 118 | bool fBtfRelayPinned = false; | ||
| 113 | string strBtfActiveRelay; | 119 | string strBtfActiveRelay; |
| 114 | static CCriticalSection cs_activeRelay; | 120 | static CCriticalSection cs_activeRelay; |
| 115 | 121 | ||
| @@ -144,7 +150,7 @@ static map<string, BtfPoolAnnouncement> g_discoveredPools; | |||
| 144 | static CCriticalSection cs_discoveredPools; | 150 | static CCriticalSection cs_discoveredPools; |
| 145 | 151 | ||
| 146 | // Basic sanity: "host:port" with a numeric 1..65535 port and a plausible host. | 152 | // Basic sanity: "host:port" with a numeric 1..65535 port and a plausible host. |
| 147 | static bool LooksLikeRelay(const string& r) | 153 | bool LooksLikeRelay(const string& r) |
| 148 | { | 154 | { |
| 149 | size_t colon = r.rfind(':'); | 155 | size_t colon = r.rfind(':'); |
| 150 | if (colon == string::npos || colon == 0 || colon + 1 >= r.size()) | 156 | if (colon == string::npos || colon == 0 || colon + 1 >= r.size()) |
| @@ -172,6 +178,8 @@ static bool LooksLikeRelay(const string& r) | |||
| 172 | vector<string> BtfAllRelays() | 178 | vector<string> BtfAllRelays() |
| 173 | { | 179 | { |
| 174 | vector<string> all = vBtfMeetingRelays; | 180 | vector<string> all = vBtfMeetingRelays; |
| 181 | if (fBtfRelayPinned) | ||
| 182 | return all; | ||
| 175 | CRITICAL_BLOCK(cs_discoveredRelays) | 183 | CRITICAL_BLOCK(cs_discoveredRelays) |
| 176 | foreach(const string& r, g_discoveredRelays) | 184 | foreach(const string& r, g_discoveredRelays) |
| 177 | if (find(all.begin(), all.end(), r) == all.end()) | 185 | if (find(all.begin(), all.end(), r) == all.end()) |