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

Method CreateStream

libi2pd/Destination.cpp:1202–1230  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1200 }
1201
1202 void ClientDestination::CreateStream (StreamRequestComplete streamRequestComplete, const i2p::data::IdentHash& dest, uint16_t port)
1203 {
1204 if (!streamRequestComplete)
1205 {
1206 LogPrint (eLogError, "Destination: Request callback is not specified in CreateStream");
1207 return;
1208 }
1209 auto leaseSet = FindLeaseSet (dest);
1210 if (leaseSet)
1211 {
1212 auto stream = CreateStream (leaseSet, port);
1213 boost::asio::post (GetService (), [streamRequestComplete, stream]()
1214 {
1215 streamRequestComplete(stream);
1216 });
1217 }
1218 else
1219 {
1220 auto s = GetSharedFromThis ();
1221 RequestDestination (dest,
1222 [s, streamRequestComplete, port](std::shared_ptr<const i2p::data::LeaseSet> ls)
1223 {
1224 if (ls)
1225 streamRequestComplete(s->CreateStream (ls, port));
1226 else
1227 streamRequestComplete (nullptr);
1228 });
1229 }
1230 }
1231
1232 void ClientDestination::CreateStream (StreamRequestComplete streamRequestComplete, std::shared_ptr<const i2p::data::BlindedPublicKey> dest, uint16_t port)
1233 {

Callers 1

CreateStreamFunction · 0.45

Calls 3

LogPrintFunction · 0.85
CreateStreamFunction · 0.85

Tested by

no test coverage detected