| 1774 | } |
| 1775 | |
| 1776 | bool CClientTCPSocket::ProcessED2Kv2Packet(const uint8_t* buffer, uint32 size, uint8 opcode) |
| 1777 | { |
| 1778 | #ifdef __PACKET_RECV_DUMP__ |
| 1779 | //printf("Rec: OPCODE %x ED2Kv2\n",opcode); |
| 1780 | DumpMem(buffer,size); |
| 1781 | #endif |
| 1782 | |
| 1783 | if (!m_client) { |
| 1784 | throw wxString("Unknown clients sends extended ED2Kv2 protocol packet"); |
| 1785 | } |
| 1786 | |
| 1787 | CMemFile data(buffer, size); |
| 1788 | try { |
| 1789 | switch(opcode) { |
| 1790 | case OP_QUEUERANK: { |
| 1791 | AddDebugLogLineN( logRemoteClient, "Remote Client: ED2Kv2 OP_QUEUERANK from " + m_client->GetFullIP() ); |
| 1792 | |
| 1793 | uint8 numtags = data.ReadUInt8(); |
| 1794 | wxASSERT(numtags == 1); |
| 1795 | if(numtags){} // prevent GCC warning |
| 1796 | |
| 1797 | m_client->SetRemoteQueueRank(data.GetIntTagValue()); |
| 1798 | |
| 1799 | theStats::AddDownOverheadFileRequest(size); |
| 1800 | break; |
| 1801 | } |
| 1802 | |
| 1803 | case OP_REQUESTPARTS: { |
| 1804 | AddDebugLogLineN( logRemoteClient, "Remote Client: ED2Kv2 OP_REQUESTPARTS from " + m_client->GetFullIP() ); |
| 1805 | |
| 1806 | m_client->ProcessRequestPartsPacketv2(data); |
| 1807 | |
| 1808 | theStats::AddDownOverheadFileRequest(size); |
| 1809 | break; |
| 1810 | } |
| 1811 | |
| 1812 | default: |
| 1813 | theStats::AddDownOverheadOther(size); |
| 1814 | AddDebugLogLineN(logRemoteClient, CFormat("ED2Kv2 packet : unknown opcode: %i %x from %s") % opcode % opcode % m_client->GetFullIP()); |
| 1815 | } |
| 1816 | } catch (...) { |
| 1817 | AddDebugLogLineN(logRemoteClient, CFormat("ED2Kv2 packet is corrupt at pos %i! opcode: %i %x from %s") % data.GetPosition() % opcode % opcode % m_client->GetFullIP()); |
| 1818 | throw; |
| 1819 | } |
| 1820 | |
| 1821 | return true; |
| 1822 | } |
| 1823 | |
| 1824 | void CClientTCPSocket::OnConnect(int nErrorCode) |
| 1825 | { |
nothing calls this directly
no test coverage detected