| 2359 | } |
| 2360 | |
| 2361 | void CConnman::ThreadI2PAcceptIncoming() |
| 2362 | { |
| 2363 | static constexpr auto err_wait_begin = 1s; |
| 2364 | static constexpr auto err_wait_cap = 5min; |
| 2365 | auto err_wait = err_wait_begin; |
| 2366 | |
| 2367 | bool advertising_listen_addr = false; |
| 2368 | i2p::Connection conn; |
| 2369 | |
| 2370 | while (!interruptNet) { |
| 2371 | |
| 2372 | if (!m_i2p_sam_session->Listen(conn)) { |
| 2373 | if (advertising_listen_addr && conn.me.IsValid()) { |
| 2374 | RemoveLocal(conn.me); |
| 2375 | advertising_listen_addr = false; |
| 2376 | } |
| 2377 | |
| 2378 | interruptNet.sleep_for(err_wait); |
| 2379 | if (err_wait < err_wait_cap) { |
| 2380 | err_wait *= 2; |
| 2381 | } |
| 2382 | |
| 2383 | continue; |
| 2384 | } |
| 2385 | |
| 2386 | if (!advertising_listen_addr) { |
| 2387 | AddLocal(conn.me, LOCAL_MANUAL); |
| 2388 | advertising_listen_addr = true; |
| 2389 | } |
| 2390 | |
| 2391 | if (!m_i2p_sam_session->Accept(conn)) { |
| 2392 | continue; |
| 2393 | } |
| 2394 | |
| 2395 | CreateNodeFromAcceptedSocket(std::move(conn.sock), NetPermissionFlags::None, |
| 2396 | CAddress{conn.me, NODE_NONE}, CAddress{conn.peer, NODE_NONE}); |
| 2397 | } |
| 2398 | } |
| 2399 | |
| 2400 | bool CConnman::BindListenPort(const CService& addrBind, bilingual_str& strError, NetPermissionFlags permissions) |
| 2401 | { |