Exemple #1
0
void				ServerManager::Manage(Packet * packet)
{
  Session			*session;
  Packet_v1			*packet_v1;
  
  packet_v1 = static_cast<Packet_v1 *>(packet);
  field_t			componentId = packet_v1->getComponentId(), requestId = packet_v1->getRequestId();
  session = _sessionManager->FindSession(packet_v1);

#ifdef _DEBUG
  COLOR_BLUE;COLOR_INTENSITY;
  std::cout << std::endl;
  std::cout << "<      RECV       > ";
  packet_v1->Print("", this);
  COLOR_DEFAULT;
#endif
  if (session)
    {
      session->setTimeOutTest();
      session->CancelTimeOutOccurred();

      if (IsRegisteredComponent(componentId))
	{
	  if (IsRegisteredRequest(componentId, requestId))
	    {
	      getBindRecv(componentId, requestId).Receive(packet_v1, session);
	      Request const & r = getRegisteredRequest(componentId, requestId);
	      if (r.IsResponseTo())
		session->CancelAutoRetry(componentId, r.getResponseTo());
	    }
	  else
	    std::cout << "UNREGISTERED REQUEST ID" << std::endl;
	}
      else
	std::cout << "UNREGISTERED COMPONENT ID" << std::endl;
    }
  else if (componentId == SESSION_COMPONENTID && requestId == SESSION_AUTHREQUEST)
    _sessionManager->Recv_AuthRequest(packet_v1, 0);
  else
    {
      //_sessionManager->PrintSession(packet);
      std::cout << "auth required" << std::endl;
      // send apropriate information
    }
}
Exemple #2
0
void				ClientManager::Manage(Packet * packet)
{
  // send packet to appropriate zone
  Packet_v1			*packet_v1;
  Session 			*session;
  static bool			exec_on_logged = 0;			

  packet_v1 = static_cast<Packet_v1 *>(packet);
  session = _session->getSession();
  
#ifdef _DEBUG
  std::cout << std::endl;
  std::cout << "<      RECV       > ";
  packet_v1->Print("", this);
#endif
  if (session)
    {
      session->setTimeOutTest();
      session->CancelTimeOutOccurred();
    }
  
  field_t	componentId = packet_v1->getComponentId(), requestId = packet_v1->getRequestId();
  if (IsRegisteredComponent(componentId))
    {
      if (IsBindRecv(componentId, requestId))
	{
	  getBindRecv(componentId, requestId).Receive(packet_v1, session);
	  Request const & r = getRegisteredRequest(componentId, requestId);
	  if (r.IsResponseTo())
	    session->CancelAutoRetry(componentId, r.getResponseTo());
	}
      else
	std::cout << "UNREGISTERED REQUEST ID" << std::endl;
    }
  else
    std::cout << "UNREGISTERED COMPONENT ID" << std::endl;
}