- Added separate drivable motors for four circle H, K, L
- Added a listen mode to commandlog in order to support the batchEditor - Some small fixes to exe* for BatchEditor
This commit is contained in:
51
conman.c
51
conman.c
@ -103,6 +103,7 @@ extern pServer pServ;
|
||||
memset(pCon,0,sizeof(SConnection));
|
||||
pCon->ident = 0;
|
||||
pCon->next = freeConnections;
|
||||
pCon->listening = 0;
|
||||
freeConnections = pCon;
|
||||
}
|
||||
/*--------------------------------------------------------------------------*/
|
||||
@ -174,6 +175,7 @@ extern pServer pServ;
|
||||
pRes->eInterrupt = eContinue;
|
||||
pRes->lMagic = CONMAGIC;
|
||||
pRes->iLogin = 0;
|
||||
pRes->listening = 0;
|
||||
pRes->conStart = time(NULL);
|
||||
pRes->write = SCNormalWrite;
|
||||
for(i = 0; i < 10; i++)
|
||||
@ -203,11 +205,6 @@ extern pServer pServ;
|
||||
pRes->iUserRights = iUser;
|
||||
pRes->iGrab = TokenGrabActive();
|
||||
|
||||
NETInfo(pRes->pSock,pHost,131);
|
||||
sprintf(pBueffel,"Accepted connection on socket %d from %s",
|
||||
pRes->pSock->sockid, pHost);
|
||||
SICSLogWrite(pBueffel,eInternal);
|
||||
WriteToCommandLog("SYS >", pBueffel);
|
||||
|
||||
return pRes;
|
||||
|
||||
@ -395,7 +392,7 @@ extern pServer pServ;
|
||||
}
|
||||
|
||||
/* log the kill */
|
||||
if(pVictim->pSock)
|
||||
if(pVictim->pSock && pVictim->iLogin == 1)
|
||||
{
|
||||
sprintf(pBueffel,"Deleting connection %d",pVictim->pSock->sockid);
|
||||
WriteToCommandLog("SYS>",pBueffel);
|
||||
@ -599,7 +596,9 @@ static int doSockWrite(SConnection *self, char *buffer)
|
||||
if(!iRet)
|
||||
{
|
||||
SCnoSock(self);
|
||||
WriteToCommandLog("SYS> ","Connection broken on send");
|
||||
if(!self->listening && self->iLogin == 1){
|
||||
WriteToCommandLog("SYS> ","Connection broken on send");
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -1358,6 +1357,7 @@ static void writeToLogFiles(SConnection *self, char *buffer)
|
||||
config Rights User Password sets and verifies new user rights
|
||||
config File Filename Logs to another file
|
||||
config output normal | withcode Sets output mode
|
||||
config listen 0 | 1 enables commandlog listen mode
|
||||
---------------------------------------------------------------------------*/
|
||||
|
||||
int ConfigCon(SConnection *pCon, SicsInterp *pSics, void *pData,
|
||||
@ -1402,6 +1402,27 @@ static void writeToLogFiles(SConnection *self, char *buffer)
|
||||
SCWrite(pCon,pBueffel,eValue);
|
||||
return 1;
|
||||
}
|
||||
else if(strcmp(argv[1],"listen") == 0)
|
||||
{
|
||||
if(argc < 3)
|
||||
{
|
||||
snprintf(pBueffel,511,"listen = %d", pCon->listening);
|
||||
SCWrite(pCon,pBueffel,eValue);
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
pCon->listening = atoi(argv[2]);
|
||||
if(pCon->listening != 0 && pCon->listening != 1)
|
||||
{
|
||||
pCon->listening = 0;
|
||||
SCWrite(pCon,"ERROR: config listen only accepts 0 or 1 as arguments",eError);
|
||||
return 0;
|
||||
}
|
||||
SCSendOK(pCon);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
/* check no or args */
|
||||
if(argc < 3)
|
||||
@ -1747,6 +1768,7 @@ static void writeToLogFiles(SConnection *self, char *buffer)
|
||||
char *pPtr = NULL;
|
||||
int iRet;
|
||||
char *pUser = NULL, *pPassword = NULL;
|
||||
char pHost[132], pBueffel[512];
|
||||
|
||||
self = (SConnection *)pData;
|
||||
if(!VerifyConnection(self))
|
||||
@ -1810,6 +1832,11 @@ static void writeToLogFiles(SConnection *self, char *buffer)
|
||||
SCWrite(self,"Login OK",eError);
|
||||
self->iLogin = 1;
|
||||
SCSetRights(self,iRet);
|
||||
NETInfo(self->pSock,pHost,131);
|
||||
sprintf(pBueffel,"Accepted connection on socket %d from %s",
|
||||
self->pSock->sockid, pHost);
|
||||
SICSLogWrite(pBueffel,eInternal);
|
||||
WriteToCommandLog("SYS >", pBueffel);
|
||||
free(pPtr);
|
||||
return 1;
|
||||
}
|
||||
@ -1863,11 +1890,19 @@ static void writeToLogFiles(SConnection *self, char *buffer)
|
||||
else if(iSignal == SICSBROADCAST)
|
||||
{
|
||||
pPtr = (char *)pSigData;
|
||||
if(pPtr)
|
||||
if(pPtr != NULL)
|
||||
{
|
||||
SCWrite(self,pPtr,eWarning);
|
||||
}
|
||||
}
|
||||
else if(iSignal == COMLOG && self->listening == 1)
|
||||
{
|
||||
pPtr = (char *)pSigData;
|
||||
if(pPtr != NULL)
|
||||
{
|
||||
doSockWrite(self,pPtr);
|
||||
}
|
||||
}
|
||||
else if(iSignal == TOKENRELEASE)
|
||||
{
|
||||
self->iGrab = 0;
|
||||
|
Reference in New Issue
Block a user