MCPcopy Create free account
hub / github.com/PurpleI2P/i2pd / AcceptStream

Method AcceptStream

libi2pd/Streaming.cpp:2378–2396  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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 {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected