| 2376 | } |
| 2377 | |
| 2378 | std::shared_ptr<Stream> StreamingDestination::AcceptStream (int timeout) |
| 2379 | { |
| 2380 | std::shared_ptr<i2p::stream::Stream> stream; |
| 2381 | std::condition_variable streamAccept; |
| 2382 | std::mutex streamAcceptMutex; |
| 2383 | std::unique_lock<std::mutex> l(streamAcceptMutex); |
| 2384 | AcceptOnce ( |
| 2385 | [&streamAccept, &streamAcceptMutex, &stream](std::shared_ptr<i2p::stream::Stream> s) |
| 2386 | { |
| 2387 | stream = s; |
| 2388 | std::unique_lock<std::mutex> l(streamAcceptMutex); |
| 2389 | streamAccept.notify_all (); |
| 2390 | }); |
| 2391 | if (timeout) |
| 2392 | streamAccept.wait_for (l, std::chrono::seconds (timeout)); |
| 2393 | else |
| 2394 | streamAccept.wait (l); |
| 2395 | return stream; |
| 2396 | } |
| 2397 | |
| 2398 | void StreamingDestination::HandlePendingIncomingTimer (const boost::system::error_code& ecode) |
| 2399 | { |
nothing calls this directly
no outgoing calls
no test coverage detected