void ListenerWorker::onMainReceived(TcpConnection* conn, StreamBuffer& istream, StreamBuffer& ostream) { #if 0 if (istream.length() < sizeof(UInt32) + strlen(sClientConnectionStr)) { return; } UInt32 connStrLen = 0; istream >> connStrLen; connStrLen = connStrLen ^ 2865; if (connStrLen != strlen(sClientConnectionStr)) { LOG_WARN("Player Connection string length don't match."); conn->close(); return; } String connStr; for (UInt32 i = 0; i < connStrLen; ++i) { unsigned char c; istream >> c; c = c ^ 103; connStr += c; } LOG_DEBUG("Received a Player connection string [%s]", connStr.c_str()); if (connStr != sClientConnectionStr) { LOG_WARN("Player Connection string don't match."); conn->close(); return; } #endif //删除回调函数,绑定别的回调函数做准备 王戊辰 LYNX_DEREGISTER_RECEIVED(conn, this, &ListenerWorker::onMainReceived); LYNX_DEREGISTER_CONNECT_BROKEN(conn, this, &ListenerWorker::onMainDisconnected); //从主链接上删除,绑定到network的连接上 王戊辰 mMainConnectionSet.erase(conn); //内部删除了读写事件 王戊辰 conn->pause(); //把io服务断开 王戊辰 conn->setService(NULL); ConnectionAcceptedNotify notify; notify.mType = 0; notify.mConnPointer = conn; postMsgToOutputQueue(notify, 0); }
void ListenerWorker::onGMReceived(TcpConnection* conn, StreamBuffer& istream, StreamBuffer& ostream) { #if 0 if (istream.length() < sizeof(UInt32) + strlen(sGMConnectionStr)) { return; } UInt32 connStrLen = 0; istream >> connStrLen; connStrLen = connStrLen ^ 2865; if (connStrLen != strlen(sGMConnectionStr)) { LOG_WARN("GMClient Connection string length don't match."); conn->close(); return; } String connStr; for (UInt32 i = 0; i < connStrLen; ++i) { unsigned char c; istream >> c; c = c ^ 103; connStr += c; } LOG_DEBUG("Received a GMClient connection string [%s]", connStr.c_str()); if (connStr != sGMConnectionStr) { LOG_WARN("GMClient Connection string don't match."); conn->close(); return; } #endif LYNX_DEREGISTER_RECEIVED(conn, this, &ListenerWorker::onGMReceived); LYNX_DEREGISTER_CONNECT_BROKEN(conn, this, &ListenerWorker::onGMDisconnected); mGMConnectionSet.erase(conn); conn->pause(); conn->setService(NULL); ConnectionAcceptedNotify notify; notify.mType = 1; notify.mConnPointer = conn; postMsgToOutputQueue(notify, 0); }