| 78 | } |
| 79 | |
| 80 | int NativeHttpClient::send(fl::span<const u8> data) { |
| 81 | if (!isConnected() || !mSocket.is_open()) { |
| 82 | return -1; |
| 83 | } |
| 84 | |
| 85 | asio::error_code ec; |
| 86 | size_t n = mSocket.write_some(data, ec); |
| 87 | |
| 88 | if (ec) { |
| 89 | if (ec.code == asio::errc::would_block) { |
| 90 | return 0; |
| 91 | } |
| 92 | mConnection.onDisconnected(); |
| 93 | return -1; |
| 94 | } |
| 95 | |
| 96 | return static_cast<int>(n); |
| 97 | } |
| 98 | |
| 99 | int NativeHttpClient::recv(fl::span<u8> buffer) { |
| 100 | if (!isConnected() || !mSocket.is_open()) { |
no test coverage detected