| 272 | } |
| 273 | |
| 274 | uint32 CProxyStateMachine::ProxyRead(CLibSocket &socket, void *buffer) |
| 275 | { |
| 276 | /* Always try to read the full buffer. That explicitly demands that |
| 277 | * the socket has the flag wxSOCKET_NONE. */ |
| 278 | m_lastRead = socket.Read(buffer, PROXY_BUFFER_SIZE); |
| 279 | /* Set the status of this operation */ |
| 280 | m_ok = true; |
| 281 | if (m_proxyClientSocket->BlocksRead()) { |
| 282 | m_lastError = 0; |
| 283 | } else if ((m_lastError = m_proxyClientSocket->LastError()) != 0) { |
| 284 | m_ok = false; |
| 285 | } |
| 286 | // We will get a new event right away if data is left, or when new data gets available. |
| 287 | // So block for now. |
| 288 | m_canReceive = false; |
| 289 | AddDebugLogLineN(logProxy, CFormat("ProxyRead %d ok %d canrec %d") % m_lastRead % m_ok % m_canReceive); |
| 290 | |
| 291 | return m_lastRead; |
| 292 | } |
| 293 | |
| 294 | bool CProxyStateMachine::CanReceive() const |
| 295 | { |
nothing calls this directly
no test coverage detected