MCPcopy Create free account
hub / github.com/axmolengine/axmol / handleNetworkEOF

Method handleNetworkEOF

core/network/HttpClient.cpp:405–442  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

403}
404
405void HttpClient::handleNetworkEOF(HttpResponse* response, yasio::io_channel* channel, int internalErrorCode)
406{
407 channel->ud_.ptr = nullptr;
408
409 channel->get_user_timer().cancel();
410 response->updateInternalCode(internalErrorCode);
411 auto responseCode = response->getResponseCode();
412 switch (responseCode)
413 {
414 case 301:
415 case 302:
416 case 307:
417 if (response->tryRedirect())
418 {
419 processResponse(response, channel->index());
420 response->release();
421 break;
422 }
423 default:
424 finishResponse(response);
425
426 // try process pending response
427 auto lck = _pendingResponseQueue.get_lock();
428 if (!_pendingResponseQueue.unsafe_empty())
429 {
430 auto pendingResponse = _pendingResponseQueue.unsafe_front();
431 _pendingResponseQueue.unsafe_pop_front();
432 lck.unlock();
433
434 processResponse(pendingResponse, channel->index());
435 pendingResponse->release();
436 }
437 else
438 { // recycle channel
439 _availChannelQueue.push_front(channel->index());
440 }
441 }
442}
443
444void HttpClient::finishResponse(HttpResponse* response)
445{

Callers

nothing calls this directly

Calls 8

indexMethod · 0.80
get_lockMethod · 0.80
unsafe_emptyMethod · 0.80
unsafe_pop_frontMethod · 0.80
cancelMethod · 0.45
releaseMethod · 0.45
unlockMethod · 0.45
push_frontMethod · 0.45

Tested by

no test coverage detected