MCPcopy Create free account
hub / github.com/BlueAndi/Pixelix / onDisconnect

Method onDisconnect

lib/AsyncHttpClient/src/AsyncHttpClient.cpp:711–745  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

709}
710
711void AsyncHttpClient::onDisconnect()
712{
713 bool isConnected;
714
715 LOG_INFO("Disconnected from %s:%u%s.", m_hostname.c_str(), m_port, m_uri.c_str());
716 LOG_DEBUG("Available heap: %u", heap_caps_get_free_size(MALLOC_CAP_INTERNAL | MALLOC_CAP_DEFAULT));
717
718 /* Protect against concurrent access. */
719 {
720 MutexGuard<Mutex> guard(m_mutex);
721
722 isConnected = m_isConnected;
723 m_isConnected = false;
724 }
725
726 if ((false == isConnected) && (false == m_isError))
727 {
728 onError(ERR_CONN);
729 }
730
731 m_isError = false;
732 clear();
733
734 /* It happens that during the connection establishment the SSL handshake fails.
735 * In this case, the connection is closed and no error is reported from the TCP client.
736 */
737 if (false == isConnected)
738 {
739 onError(ERR_CONN);
740 }
741
742 notifyClosed();
743
744 giveGlobalMutex();
745}
746
747void AsyncHttpClient::onError(int8_t error)
748{

Callers 2

AsyncHttpClientMethod · 0.45
~AsyncHttpClientMethod · 0.45

Calls 1

c_strMethod · 0.80

Tested by

no test coverage detected