MCPcopy Create free account
hub / github.com/cuberite/cuberite / RelayFromClient

Method RelayFromClient

Tools/ProtoProxy/Connection.cpp:398–430  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

396
397
398bool 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

Callers

nothing calls this directly

Calls 1

ProcessDataMethod · 0.80

Tested by

no test coverage detected