aMule Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

We're back! (IN POG FORM)

Author Topic: Packet.cpp(275): assert "prot == OP_PACKEDPROT" failed in UnPackPacket().  (Read 3302 times)

phoenix

  • Evil respawning bird from aMule Dev Team
  • Developer
  • Hero Member
  • *****
  • Karma: 44
  • Offline Offline
  • Posts: 2503
  • The last shadow you'll ever see

Code: [Select]
ASSERT INFO:
Packet.cpp(275): assert "prot == OP_PACKEDPROT" failed in UnPackPacket().

BACKTRACE:
[1] wxOnAssert(wchar_t const*, int, char const*, wchar_t const*, wchar_t const*)
[2] CPacket::UnPackPacket(unsigned int) /home/asdf/trunk5/src/Packet.cpp:277
[3] CClientTCPSocket::PacketReceived(CPacket*) /home/asdf/trunk5/src/ClientTCPSocket.cpp:2040
[4] CEMSocket::OnReceive(int) /home/asdf/trunk5/src/EMSocket.cpp:284
[5] CClientTCPSocket::OnReceive(int) /home/asdf/trunk5/src/ClientTCPSocket.cpp:1966
[6] CClientTCPSocketHandler::ClientTCPSocketHandler(wxSocketEvent&) /home/asdf/trunk5/src/ClientTCPSocket.cpp:101
[7] wxAppConsole::HandleEvent(wxEvtHandler*, void (wxEvtHandler::*)(wxEvent&), wxEvent&) cons)
[8] wxEvtHandler::ProcessEventIfMatches(wxEventTableEntryBase const&, wxEvtHandler*, wxEvent&)
[9] wxEventHashTable::HandleEvent(wxEvent&, wxEvtHandler*)
[10] wxEvtHandler::ProcessEvent(wxEvent&)
[11] wxEvtHandler::ProcessPendingEvents()
[12] wxAppConsole::ProcessPendingEvents()
[13] wxAppBase::ProcessIdle()
[14] g_main_context_dispatch()
[15] g_main_loop_run()
[16] gtk_main()
[17] wxEventLoop::Run()
[18] wxAppBase::MainLoop()

The problem is that in src/Packet.cpp we "wxASSERT( prot == OP_PACKEDPROT );", but in src/ClientTCPSocket.cpp:2037 we have:

Code: [Select]
if ((packet->GetProtocol() == OP_PACKEDPROT) ||
(packet->GetProtocol() == OP_ED2KV2PACKEDPROT)) {

Most likely the assertion is wrong, but I leave that to you folks, the protocol issues are not fresh in my mind... Anyway the suggested patch follows, feel free to commit or not, the decision is yours.

Cheers!
Logged

Kry

  • Ex-developer
  • Retired admin
  • Hero Member
  • *****
  • Karma: -665
  • Offline Offline
  • Posts: 5795

We don't even send OP_ED2KV2PACKEDPROT, ever, and we're the only ones that create that (because it's my test code, and it's not enabled).

More likely than not your packet had a wrong protocol number, either coming from another client or just a wrong packet. We should probably log instead of assert in this case.

BUT

You're right, that assert had to be updated anyway to reflect OP_ED2KV2PACKEDPROT.
Logged

phoenix

  • Evil respawning bird from aMule Dev Team
  • Developer
  • Hero Member
  • *****
  • Karma: 44
  • Offline Offline
  • Posts: 2503
  • The last shadow you'll ever see

Weird. Maybe someone else is playing with protocol.

Anyway, I have committed a version that logs it.

Cheers!
Logged