| 396 | |
| 397 | |
| 398 | bool cConnection::RelayFromClient(void) |
| 399 | { |
| 400 | char Buffer[64 KiB]; |
| 401 | int res = recv(m_ClientSocket, Buffer, sizeof(Buffer), 0); |
| 402 | if (res <= 0) |
| 403 | { |
| 404 | Log("Client closed the socket: %d; %d; aborting connection", res, SocketError); |
| 405 | return false; |
| 406 | } |
| 407 | |
| 408 | DataLog(Buffer, res, "Received %d bytes from the CLIENT", res); |
| 409 | |
| 410 | switch (m_ClientState) |
| 411 | { |
| 412 | case csUnencrypted: |
| 413 | case csWaitingForEncryption: |
| 414 | { |
| 415 | return DecodeClientsPackets(Buffer, res); |
| 416 | } |
| 417 | case csEncryptedUnderstood: |
| 418 | { |
| 419 | return DecodeClientsPackets(Buffer, res); |
| 420 | } |
| 421 | case csEncryptedUnknown: |
| 422 | { |
| 423 | DataLog(Buffer, res, "Decrypted %d bytes from the CLIENT", res); |
| 424 | m_ServerEncryptor.ProcessData((Byte *)Buffer, (Byte *)Buffer, res); |
| 425 | return SERVERSEND(Buffer, res); |
| 426 | } |
| 427 | } |
| 428 | ASSERT(!"Unhandled server state while relaying from client"); |
| 429 | return false; |
| 430 | } |
| 431 | |
| 432 | |
| 433 |
nothing calls this directly
no test coverage detected