예제 #1
0
///
/// \brief  Add NET Connection
///
/// \param  pNETConnection  [I ] NET Connection
///
/// \return ALT_S_SUCCESS success
///
LIBALT_API alt_t altNETReceiverBroker::Add(const altCNETConnectionPtr & pNETConnection)
{
  altUInt nMinSize = 0;
  altNETReceiver * pReceiver = NULL;

  BeginLock();
  // select min count container
  for (altUInt i = 0; i < m_oNETReceiverContainer.size(); i++) {
    if (i == 0) {
      pReceiver = m_oNETReceiverContainer[i];
      nMinSize = m_oNETReceiverContainer[i]->Size();
      continue;
    }

    if (nMinSize >= m_oNETReceiverContainer[i]->Size()) {
      pReceiver = m_oNETReceiverContainer[i];
      nMinSize = m_oNETReceiverContainer[i]->Size();
    }
  }

  // add to min count container
  alt_t status = pReceiver->Add (pNETConnection);
  EndLock();

  if (status == ALT_I_MAX) {
    CreateNewNETReceiver();
    status = Add (pNETConnection);
  }
  ALT_RET (ALT_S_SUCCESS);
}
예제 #2
0
///
/// \brief  Delete all client connection
///
LIBALT_API void altNETReceiverBroker::DelAllClient()
{
  BeginLock();
  for (altUInt i = 0; i < m_oNETReceiverContainer.size(); i++) {
    m_oNETReceiverContainer[i]->DelAllClient();
  }
  EndLock();
}
예제 #3
0
///
/// \brief  Delete all client connection
///
LIBALT_API void altNETReceiver::DelAllClient()
{
  BeginLock();
  for (altNETConnectionMap::iterator i = m_oConnectionMap.begin(); i != m_oConnectionMap.end(); i++) {
    if (! aiNETConnectionManager.IsServerIP ((* i).second->GetIP())) {
      m_oConnectionMap.erase (i);
    }
  }
  EndLock();
}
예제 #4
0
///
/// \brief  Add Connection
///
/// \param  pConnection [I ] NET Connection
///
/// \return ALT_S_SUCCESS   success
/// \return ALT_I_MAX       max
///
LIBALT_API alt_t altNETReceiver::Add(const altCNETConnectionPtr & pConnection)
{
  BeginLock();
  if (Size() >= FD_SETSIZE) {
    EndLock();
    ALT_RET (ALT_I_MAX);
  }
  m_oConnectionMap[pConnection->GetSocket()] = pConnection;
  EndLock();
  ALT_RET (ALT_S_SUCCESS);
}
예제 #5
0
///
/// \brief  Delete NET Connection
///
/// \param  pNETConnection  [I ] NET Connection
///
/// \return ALT_S_SUCCESS success
///
LIBALT_API alt_t altNETReceiverBroker::Del(const altCNETConnectionPtr & pNETConnection)
{
  BeginLock();
  for (altUInt i = 0; i < m_oNETReceiverContainer.size(); i++) {
    alt_t status = m_oNETReceiverContainer[i]->Del (pNETConnection);
    if (status == ALT_S_SUCCESS) {
      break;
    }
  }
  EndLock();
  ALT_RET (ALT_S_SUCCESS);
}
예제 #6
0
///
/// \brief  Set receive buffer size
///
/// \param  nSize [I ] receive buffer size
///
/// \return ALT_S_SUCCESS   success
/// \return ALT_E_INVAL     invalid paramter
///
LIBALT_API alt_t altNETReceiverBroker::SetRecvBufferSize(const altUInt nSize)
{
  ALT_P_ASSERT (nSize != 0);
  BeginLock();
  for (altUInt i = 0; i < m_oNETReceiverContainer.size(); i++) {
    alt_t status = m_oNETReceiverContainer[i]->SetRecvBufferSize (nSize);
    if (ALT_IS_ERR (status)) {
      EndLock();
      ALT_RET (status);
    }
  }
  EndLock();
  ALT_RET (ALT_S_SUCCESS);
}
예제 #7
0
///
/// \brief  Del Connection
///
/// \param  pConnection [I ] NET Connection
///
/// \return ALT_S_SUCCESS   success
/// \return ALT_S_NOT_FOUND not found
///
LIBALT_API alt_t altNETReceiver::Del(const altCNETConnectionPtr & pConnection)
{
  BeginLock();
  altNETConnectionMap::iterator i = m_oConnectionMap.find (pConnection->GetSocket());
  if (i != m_oConnectionMap.end()) {
    m_oConnectionMap.erase (i);
  }
  else {
    EndLock();
    ALT_RET (ALT_S_NOT_FOUND);
  }
  EndLock();
  ALT_RET (ALT_S_SUCCESS);
}
예제 #8
0
///
/// \brief  New NET Receiver
///
LIBALT_API void altNETReceiverBroker::CreateNewNETReceiver()
{
  altNETReceiver * pNETReceiver = ALT_NEW altNETReceiver (m_pReceiveCallBackFunc, m_nRequestThreadCount, aiNETConnectionManager.GetRecvBufferSize());
  if (pNETReceiver != NULL) {
    alt_t status = pNETReceiver->Start();
    if (ALT_IS_ERR (status)) {
      ALT_LOG (status);
      delete pNETReceiver;
      return;
    }
    BeginLock();
    m_oNETReceiverContainer.push_back (pNETReceiver);
    EndLock();
  }
}
void FScopedAggregatorOnDirtyBatch::BeginNetReceiveLock()
{
	BeginLock();
}
FScopedAggregatorOnDirtyBatch::FScopedAggregatorOnDirtyBatch()
{
	BeginLock();
}