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