list iterator not dereferencable (PushFramework3.0)


.\3.0\ProtocolFramework\src\Connection.cpp (line 57)
ProtocolContext& Connection::getProtocolContext( Protocol* pProtocol )
        protocolContextMapT::iterator it  = internal->protocolContextMap.find(pProtocol);
        return *(it->second);
when internal->protocolContextMap.size() = 0, error


smiletiger wrote Oct 13, 2014 at 8:50 AM

stack info:
>   ProtocolFramework.dll!ProtocolFramework::Connection::getProtocolContext(ProtocolFramework::Protocol * pProtocol) 行 56   C++
    ProtocolFramework.dll!ProtocolFramework::Connection::AdvanceInitialization(ProtocolFramework::Buffer & outgoingBytes) 行 66  C++
    TCPSocket.dll!TCPSocketImpl::OnConnect() 行 202  C++
    TCPSocket.dll!TCPSocketImpl::doNetworkJobs() 行 507  C++
    TCPSocket.dll!TCPSocketImpl::networkJobsThreadProc(void * lParam) 行 191 C++
    msvcr110d.dll!_callthreadstartex() 行 354    C
    msvcr110d.dll!_threadstartex(void * ptd) 行 337  C
    kernel32.dll!77c81154() 未知
    [下面的框架可能不正确和/或缺失,没有为 kernel32.dll 加载符号] 
    ntdll.dll!77b3b299()    未知
    ntdll.dll!77b3b26c()    未知

charfeddineahmed wrote Oct 14, 2014 at 1:28 AM

This is an indication that in your own implementation of Protocol::createNewProtocolContext, you returned

Note that even if you do not supply a custom protocol context, leave the default implementation:
ProtocolContext* Protocol::createNewProtocolContext()
    return new ProtocolContext();
a protocol context at least does the job of cumulating received bytes untill something decodable is at hand.
So it is a vital thing.
Push framework will crash without it.
The same goes for tcpsocket project which i gave as an example to reuse protocol implementations symetrically (both server code and client code).

smiletiger wrote Oct 14, 2014 at 2:03 PM


I'm sorry I forgot to tell you, I am trying to run 3.0 \ WebsocketServer \ Websocket.sln found the problem detected.


I simply changed the two parts of the code to ensure successful compilation. Then try to run DemoServer. Exe and DemoClient. Exe,. The results showed that DemoClient exe wrong.


In WebsocketProtocol.CPP, createNewProtocolContext () set the breakpoint,but did not run to the breakpoint

I am sorry that I use the machine translation, because my English is very poor