Beispiel #1
0
void freePools()
{
    freePool(&g_mem_1k, 1024);
    freePool(&g_mem_16k, 16*1024);
    freePool(&g_mem_64k, 64*1024);
    freePool(&g_mem_1024k, 1024*1024);
}
Beispiel #2
0
void
ResetThreads(void)
{
    int i;

    for (i = 0; i < MaxFds; ++i) {
	ForkDesc *desc;
	if ((desc = FDes[i]) != NULL) {
	    if (desc->d_Timer) {
		DelTimer(desc->d_Timer);
		desc->d_Timer = NULL;
	    }
	    if (desc->d_Fd >= 0) {
		close(desc->d_Fd);
		desc->d_Fd = -1;
	    }
	    if (desc->d_FdPend >= 0) {
		close(desc->d_FdPend);
		desc->d_FdPend = -1;
	    }
	}
    }
    FD_ZERO(&SFds);
    FD_ZERO(&RFds);
    FD_ZERO(&WFds);
    bzero(FDes, sizeof(FDes));
    freePool(&TMemPool);
    MaxFds = 0;
}
Beispiel #3
0
void
ActiveCacheFreeMain(void)
{
    freePool(&activeCache_MemPool);
    activeCache_MemPool = NULL;
    activeCache = NULL;
}
Beispiel #4
0
void
DeleteConnection(Connection *conn)
{
    MemPool *mpool = conn->co_MemPool;

    if (conn->co_Desc->d_Type == THREAD_SPOOL) {
	conn->co_LastServerLog = 1;
	LogServerInfo(conn, TFd);
    } else if (conn->co_Desc->d_Type == THREAD_NNTP) {
	char statbuf[1024];
	char vsbuf[11];
	char hsbuf[31];

	snprintf(vsbuf, sizeof(vsbuf), "%s", conn->co_Auth.dr_VServerDef->vs_Name);

	snprintf(hsbuf, sizeof(hsbuf), "%s%s%s%s%s",
		*conn->co_Auth.dr_AuthUser ? conn->co_Auth.dr_AuthUser : "",
		*conn->co_Auth.dr_AuthUser ? "/" : "",
		*conn->co_Auth.dr_IdentUser ? conn->co_Auth.dr_IdentUser : "",
		*conn->co_Auth.dr_IdentUser ? "@" : "",
		conn->co_Auth.dr_Host);
	RTStatusBase(conn->co_Desc->d_Slot, "CLSD %-10s %-30s", vsbuf, hsbuf);

	GroupStats(conn);

	snprintf(statbuf, sizeof(statbuf), "exit articles %lu groups %lu posts %lu bytes %.0f", conn->co_ClientTotalArticleCount, conn->co_ClientGroupCount, conn->co_ClientPostCount, conn->co_ClientTotalByteCount);
	LogCmd(conn, '$', statbuf);

	StatusUpdate(conn, "(closed)");
	freeReaderSlot(conn->co_Desc->d_Slot);
	--NumReaders;
	/*
	 * Inform the main server that we are done with the descriptor
	 * by writing the DnsRes structure back to it, so the main server
	 * can track who from where is connecting to what and when that
	 * connection terminates.
	 */
	conn->co_Auth.dr_ByteCount = conn->co_TMBuf.mh_TotalBytes;
	SendMsg(TFd, conn->co_Desc->d_Fd, &conn->co_Auth);
    }

    FreeControl(conn);
    freePool(&conn->co_BufPool);
    freePool(&mpool);		/* includes Connection structure itself */
}
void EventManager::publishNetworkPool(BaseEventPool* pool)
{
	boost::mutex::scoped_lock scoped_lock(mEventChannelListMutex);

	if (mThreadCount > 0)
	{
		BaseEventPool* poolClone = requestPool();
		pool->copyTo(poolClone);
		mEventChannelList[0]->receiveEventPool(poolClone);
	}
	freePool(pool);
}
bool EventManager::doOperate()
{
	infolog << "New Tick";
	//! \todo rename InternalMutex to OperationMutex or something
	//! InternalMutex is only for DoOperate function ?
	boost::try_mutex::scoped_try_lock internal_lock(mInternalMutex); 
	if (!internal_lock.owns_lock())
	{
		return false;
	}

	// Aquire all necessary Locks
	boost::mutex::scoped_lock scoped_lock(mEventChannelListMutex);

	bool didWork = false;
	for (size_t i = 0; i < mThreadCount; ++i)
	{
		BaseEventPool* pool;
		while ((pool = mEventChannelList[i]->getPublishedEventPool()))
		{
			didWork = true;
			transmitPool(pool); // transmit to networkchannels

			// transmit to all other threads
			for (size_t j = 0; j < mThreadCount; ++j)
			{
				if (j != i)
				{
					BaseEventPool* poolClone = requestPool();
					pool->copyTo(poolClone);
					mEventChannelList[j]->receiveEventPool(poolClone);
				}
			}

			// we don't need this pool anymore
			freePool(pool);
		}
	}
	return didWork;
}
Beispiel #7
0
void
loadExpireCtl(FILE *fi)
{
    char buf[MAXGNAME+256];
    int line = 0;
    OverExpire **pov = &OvExBase;

    if (DebugOpt)
	printf("Loading dexpire.ctl\n");

    freePool(&EXMemPool);
    while (fi && fgets(buf, sizeof(buf), fi) != NULL) {
	char *p = buf;
	char *q = buf;

	line++;
	while (isspace((int)*p))
	    p++;
	if (!*p || *p == '/' || *p == '#')
	    continue;

	if ((q = strchr(p, ':')) != NULL) {
	    int n;
	    OverExpire *ov = zalloc(&EXMemPool,
					sizeof(OverExpire) + (q - p) + 1);
	    ov->oe_ExpireDays = -2.0;
	    ov->oe_LimitDays = -2.0;
	    ov->oe_InitArts = -2;
	    ov->oe_MinArts = -2;
	    ov->oe_MaxArts = -2;
	    ov->oe_DataSize = -2;
	    ov->oe_StoreGZDays = -2.0;

	    memmove(&ov->oe_Wild, buf, q - p);
	    ov->oe_Wild[q-p] = 0;
	    *pov = ov;
	    pov = &ov->oe_Next;

	    q = p;
	    while ((q = strchr(q + 1, ':')) != NULL) {
		switch(q[1]) {
		    case 'a':
			ov->oe_InitArts = strtol(q + 2, NULL, 0);
			break;
		    case 'i':
			ov->oe_MinArts = strtol(q + 2, NULL, 0);
			break;
		    case 'j':
			ov->oe_MaxArts = strtol(q + 2, NULL, 0);
			break;
		    case 'e':
			n = strtol(q + 2, NULL, 0);
			if ((n ^ (n - 1)) != (n << 1) - 1) {
			    logit(LOG_ERR, "dexpire.ctl 'e' option not a power of 2 in line %d - ignoring", line);
			
			} else {
			    ov->oe_DataSize = n;
			}
			break;
		    case 'x':
			ov->oe_ExpireDays = strtod(q + 2, NULL);
			break;
		    case 'l':
			if (q[2] == 'x')
				ov->oe_LimitDays = -1;
			else
				ov->oe_LimitDays = strtod(q + 2, NULL);
			break;
		    case 'Z':
			ov->oe_StoreGZDays = strtod(q + 2, NULL);
			break;
		}
	    }
	}
    }
    *pov = NULL;
}
Beispiel #8
0
retCode delPkg(packagePo pkg, packagePo p) {
  freePool(pkgPool, p);
  return Ok;
}