MCPcopy Create free account
hub / github.com/GrapheneCt/NetStream / AddHttp

Method AddHttp

NetStream/source/tex_pool.cpp:271–316  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

269}
270
271bool TexPool::AddHttp(IDParam const& id, const char *path)
272{
273 int32_t res = -1;
274 CurlFile::OpenArg oarg;
275 oarg.ParseUrl(path);
276 oarg.SetOption(3000, CurlFile::OpenArg::OptionType_ConnectTimeOut);
277 oarg.SetOption(5000, CurlFile::OpenArg::OptionType_RecvTimeOut);
278 oarg.SetProxy(utils::GetGlobalProxy());
279 if (m_share)
280 {
281 oarg.SetShare(m_share);
282 }
283
284 if (!m_alive)
285 {
286 return false;
287 }
288 CurlFile *file = new CurlFile();
289 res = file->Open(&oarg);
290 if (res != SCE_PAF_OK)
291 {
292 delete file;
293 Remove(id);
294 return false;
295 }
296
297 if (!m_alive)
298 {
299 delete file;
300 return false;
301 }
302 common::SharedPtr<CurlFile> hfile(file);
303 intrusive_ptr<graph::Surface> tex = graph::Surface::Load(gutil::GetDefaultSurfacePool(), reinterpret_cast<common::SharedPtr<File>&>(hfile));
304 if (tex.get())
305 {
306 m_storMtx->Lock();
307 RemoveForReplace(id);
308 m_stor[id.GetIDHash()] = tex;
309 m_storMtx->Unlock();
310 return true;
311 }
312
313 Remove(id);
314
315 return false;
316}
317
318bool TexPool::AddLocal(IDParam const& id, const char *path)
319{

Callers

nothing calls this directly

Calls 4

SetShareMethod · 0.80
LockMethod · 0.80
UnlockMethod · 0.80
OpenMethod · 0.45

Tested by

no test coverage detected