| 683 | } |
| 684 | |
| 685 | void AsyncHttpClient::onConnect() |
| 686 | { |
| 687 | bool isReqOpen = false; |
| 688 | |
| 689 | LOG_INFO("Connected to %s:%u%s.", m_hostname.c_str(), m_port, m_uri.c_str()); |
| 690 | LOG_DEBUG("Available heap: %u", heap_caps_get_free_size(MALLOC_CAP_INTERNAL | MALLOC_CAP_DEFAULT)); |
| 691 | |
| 692 | /* Protect against concurrent access. */ |
| 693 | { |
| 694 | MutexGuard<Mutex> guard(m_mutex); |
| 695 | |
| 696 | m_isConnected = true; |
| 697 | isReqOpen = m_isReqOpen; |
| 698 | m_isReqOpen = false; |
| 699 | } |
| 700 | |
| 701 | /* Is there a queued request, which to send? */ |
| 702 | if (true == isReqOpen) |
| 703 | { |
| 704 | if (false == sendRequest()) |
| 705 | { |
| 706 | m_tcpClient.close(); |
| 707 | } |
| 708 | } |
| 709 | } |
| 710 | |
| 711 | void AsyncHttpClient::onDisconnect() |
| 712 | { |
no test coverage detected