- do not write commands twice when listening
This commit is contained in:
14
conman.c
14
conman.c
@ -94,6 +94,8 @@ extern pServer pServ;
|
||||
static int iName = 0;
|
||||
static SConnection *freeConnections = NULL;
|
||||
static long lastIdent = 0;
|
||||
/*------------- sending connection (prevent double write when listening) ----*/
|
||||
static SConnection *sendingConnection = NULL;
|
||||
/*===========================================================================*/
|
||||
static char *ConName(long ident) {
|
||||
static char name[32];
|
||||
@ -702,7 +704,9 @@ static void writeToLogFiles(SConnection *self, char *buffer)
|
||||
if(SCGetRights(self) <= usUser && self->iMacro != 1)
|
||||
{
|
||||
sprintf(pBueffel,"To sock %d :",iRet);
|
||||
sendingConnection = self;
|
||||
WriteToCommandLog(pBueffel,buffer);
|
||||
sendingConnection = NULL;
|
||||
}
|
||||
|
||||
/* put it into the interpreter if present */
|
||||
@ -761,7 +765,9 @@ static void writeToLogFiles(SConnection *self, char *buffer)
|
||||
if(SCGetRights(self) <= usUser && self->iMacro != 1)
|
||||
{
|
||||
sprintf(pBueffel,"To sock %d :",iRet);
|
||||
sendingConnection = self;
|
||||
WriteToCommandLog(pBueffel,buffer);
|
||||
sendingConnection = NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1431,7 +1437,9 @@ pDynString SCEndBuffering(SConnection *pCon)
|
||||
{
|
||||
strcat(pBueffel,"CONT or CRON>> ");
|
||||
}
|
||||
sendingConnection = self;
|
||||
WriteToCommandLog(pBueffel,pCommand);
|
||||
sendingConnection = NULL;
|
||||
}
|
||||
|
||||
/* invoke */
|
||||
@ -1953,8 +1961,8 @@ pDynString SCEndBuffering(SConnection *pCon)
|
||||
SCSetRights(self,iRet);
|
||||
pHost[0] = '\0';
|
||||
NETInfo(self->pSock,pHost,131);
|
||||
sprintf(pBueffel,"Accepted connection on socket %d from %s",
|
||||
self->pSock->sockid, pHost);
|
||||
sprintf(pBueffel,"Accepted connection %s on socket %d from %s",
|
||||
ConName(self->ident), self->pSock->sockid, pHost);
|
||||
SICSLogWrite(pBueffel,eInternal);
|
||||
WriteToCommandLog("SYS >", pBueffel);
|
||||
free(pPtr);
|
||||
@ -2018,7 +2026,7 @@ pDynString SCEndBuffering(SConnection *pCon)
|
||||
else if(iSignal == COMLOG && self->listening == 1)
|
||||
{
|
||||
pPtr = (char *)pSigData;
|
||||
if(pPtr != NULL)
|
||||
if(pPtr != NULL && self != sendingConnection)
|
||||
{
|
||||
doSockWrite(self,pPtr);
|
||||
}
|
||||
|
Reference in New Issue
Block a user