| 356 | |
| 357 | |
| 358 | bool cConnection::RelayFromServer(void) |
| 359 | { |
| 360 | char Buffer[64 KiB]; |
| 361 | int res = recv(m_ServerSocket, Buffer, sizeof(Buffer), 0); |
| 362 | if (res <= 0) |
| 363 | { |
| 364 | Log("Server closed the socket: %d; %d; aborting connection", res, SocketError); |
| 365 | return false; |
| 366 | } |
| 367 | |
| 368 | DataLog(Buffer, res, "Received %d bytes from the SERVER", res); |
| 369 | |
| 370 | switch (m_ServerState) |
| 371 | { |
| 372 | case csUnencrypted: |
| 373 | case csWaitingForEncryption: |
| 374 | { |
| 375 | return DecodeServersPackets(Buffer, res); |
| 376 | } |
| 377 | case csEncryptedUnderstood: |
| 378 | { |
| 379 | m_ServerDecryptor.ProcessData((Byte *)Buffer, (Byte *)Buffer, res); |
| 380 | DataLog(Buffer, res, "Decrypted %d bytes from the SERVER", res); |
| 381 | return DecodeServersPackets(Buffer, res); |
| 382 | } |
| 383 | case csEncryptedUnknown: |
| 384 | { |
| 385 | m_ServerDecryptor.ProcessData((Byte *)Buffer, (Byte *)Buffer, res); |
| 386 | DataLog(Buffer, res, "Decrypted %d bytes from the SERVER", res); |
| 387 | return CLIENTSEND(Buffer, res); |
| 388 | } |
| 389 | } |
| 390 | ASSERT(!"Unhandled server state while relaying from server"); |
| 391 | return false; |
| 392 | } |
| 393 | |
| 394 | |
| 395 |
nothing calls this directly
no test coverage detected