Beispiel #1
0
/* Release all clients */
static void releaseAllClients() {
  int clientIndex;

  for (clientIndex = clientCount - 1; clientIndex >= 0; clientIndex--) {
    releaseClient(&clientList[clientIndex]);
  }
}
Beispiel #2
0
void HTTPProc(clientParams* cParams)
{
	assembleBuffer(cParams);
	cParams->parser->parseRequest(cParams->task);
	cParams->task->runner->run(cParams->task);
	releaseClient(cParams);
}
Beispiel #3
0
// release client memory
// close client all sock descriptior
void destroyClient(TGClient * pCli)
{
	if(pCli!=NULL)
	{
		releaseClient(pCli);
	}
}
Beispiel #4
0
void WebAssociatedURLLoaderImpl::ClientAdapter::notifyError(TimerBase* timer) {
  DCHECK_EQ(timer, &m_errorTimer);

  if (m_client)
    releaseClient()->didFail(m_error);
  // |this| may be dead here.
}
UtlBoolean SipProtocolServerBase::send(SipMessage* message,
                            const char* hostAddress,
                            int hostPort)
{
    UtlBoolean sendOk = FALSE;


    UtlString localIp(message->getLocalIp());
    
    if (localIp.length() < 1)
    {
        localIp = mDefaultIp;
    }

    SipClient* client = createClient(hostAddress, hostPort, localIp);
    if(client)
    {
        int isBusy = client->isInUseForWrite();
        UtlString clientNames;

        client->getClientNames(clientNames);
        OsSysLog::add(FAC_SIP, PRI_DEBUG, "Sip%sServerBase::send %p isInUseForWrite %d, client info\n %s",
                mProtocolString.data(), client, isBusy, clientNames.data());

        sendOk = client->sendTo(*message, hostAddress, hostPort);
        if(!sendOk)
        {
            OsTask* pCallingTask = OsTask::getCurrentTask();
            OsTaskId_t callingTaskId = -1;
            OsTaskId_t clientTaskId = -1;

            if ( pCallingTask )
            {
               pCallingTask->id(callingTaskId);
            }
            client->id(clientTaskId);

            if (clientTaskId != callingTaskId)
            {
               // Do not need to clientLock.acquireWrite();
               // as deleteClient uses the locking list lock
               // which is all that is needed as the client is
               // already marked as busy when we called
               // createClient above.
               deleteClient(client);
               client = NULL;
            }
        }
    }

        if(client)
        {
            releaseClient(client);
        }

    return(sendOk);
}
Beispiel #6
0
void WebAssociatedURLLoaderImpl::documentDestroyed() {
  disposeObserver();
  cancelLoader();

  if (!m_client)
    return;

  releaseClient()->didFail(ResourceError());
  // |this| may be dead here.
}
Beispiel #7
0
void EmbedArea::setClient( Embeddable& client )
{
    releaseClient();
    pClient = &client;
    pClient->attachedEvent();

    this->layout()->addWidget( &client );
    this->setFrameStyle( QFrame::Box | QFrame::Sunken );

    emit clientEmbedded( client );
}
Beispiel #8
0
void WebAssociatedURLLoaderImpl::ClientAdapter::didFinishLoading(
    unsigned long identifier,
    double finishTime) {
  if (!m_client)
    return;

  m_loader->clientAdapterDone();

  releaseClient()->didFinishLoading(finishTime);
  // |this| may be dead here.
}
Beispiel #9
0
void closeAllClient()
{
	int i=0;
	int count=CAL_CLIENT_ARRAY_SIZE;
	for(i=0;i<count;i++)
	{
		TGClient * pC=g_clients[i];
		if(pC!=NULL)
		{
			logN("CONTEXT",LOG_LEVEL_DEBUG," opid:%d close client: addres:%d pid:%d, port:%d",getTGServerPid(),pC,pC->pid,pC->port);
			releaseClient(pC);
			g_clients[i]=NULL;
		}

	}

}
Beispiel #10
0
// close client connection
//  and remove client from  global clients array
void closeClient(tg_pid pid)
{
	int i=0;
	int count=CAL_CLIENT_ARRAY_SIZE;
	for(i=0;i<count;i++)
	{
		TGClient * pC=g_clients[i];
		if(pC!=NULL && pC->pid==pid)
		{
			g_clients[i]=NULL;
			releaseClient(pC);
			// record current client connection counts	
			g_context->curClientCounts--;
			return;
		}
	}

}
Beispiel #11
0
static void releaseClientArray()
{
	//release old array
	TGClient * pT;
	int i=0;
	for(i=0;i<clients_ar_size;i++)
	{
		pT=g_clients[i];
		if(pT!=NULL)
		{
			releaseClient(pT);
		}	
	}
	
	memset(g_clients,0,clients_ar_size * sizeof(TGClient *));
	free(g_clients);
	g_clients=NULL;

}
Beispiel #12
0
/* interval we expect, declare them dead and remove them       */
static void doClientTimeoutChecks(int actualElapsedTime, xPL_ObjectPtr userValue) {
  int clientIndex, elapsedTime;
  time_t rightNow = time(NULL);
  hubClientPtr theClient;

  xPL_Debug("Checking for client timeouts...");

  for (clientIndex = clientCount - 1; clientIndex >= 0; clientIndex--) {
    theClient = &clientList[clientIndex];

    /* Figure elapsed time since we've last heard from this client */
    elapsedTime = (rightNow - theClient->lastHeardFromAt) / 60;
    xPL_Debug("  Checking client #%d on port %d -- %d minutes since last heard from", clientIndex, theClient->clientPort, elapsedTime);

    /* See if this exceeds twice the expected heartbeat interval */
    if (elapsedTime < ((theClient->heartbeatInterval * 2) + 1)) continue;
    
    /* We have not heard from this client -- remove it */
    xPL_Debug("Havn't heard from client @ port %d in %d minutes (heartbeats expected every %d minutes) -- Removing it",
	      theClient->clientPort, elapsedTime, theClient->heartbeatInterval);
    releaseClient(theClient);
  }
}
Beispiel #13
0
void WebAssociatedURLLoaderImpl::clientAdapterDone() {
  disposeObserver();
  releaseClient();
}
Beispiel #14
0
void WebAssociatedURLLoaderImpl::cancel() {
  disposeObserver();
  cancelLoader();
  releaseClient();
}