private void OnSwitch(ulong hSocket, uint oldServiceId, uint newServiceId) { if (m_nMainThreads == uint.MaxValue) { m_nMainThreads = ServerCoreLoader.GetMainThreads(); } CBaseService bsOld; if (oldServiceId != BaseServiceID.sidStartup && (bsOld = SeekService(oldServiceId)) != null) { bsOld.ReleasePeer(hSocket, false, newServiceId); } CBaseService bsNew = SeekService(newServiceId); if (bsNew != null) { CSocketPeer sp = bsNew.CreatePeer(hSocket, newServiceId); sp.m_bRandom = bsNew.ReturnRandom; if (newServiceId == BaseServiceID.sidHTTP) { CHttpPeerBase hp = (CHttpPeerBase)sp; hp.m_bHttpOk = false; } else { sp.m_os = ServerCoreLoader.GetPeerOs(hSocket, ref sp.m_endian); sp.m_qBuffer.OS = sp.m_os; sp.m_qBuffer.Endian = sp.m_endian; } sp.OnSwitch(oldServiceId); } }