- Adapted indenation to new agreed upon system
- Added support for second generation scriptcontext based counter
This commit is contained in:
67
sicsexit.c
67
sicsexit.c
@ -48,46 +48,41 @@
|
||||
/*----------------------------------------------------------------------
|
||||
Below waits for 5 cycles in order to give everybody time to shut down
|
||||
properly. Then this one will die as well
|
||||
*/
|
||||
static int WaitTask(void *pData)
|
||||
{
|
||||
static int iCount = 0;
|
||||
*/
|
||||
static int WaitTask(void *pData)
|
||||
{
|
||||
static int iCount = 0;
|
||||
|
||||
iCount++;
|
||||
if(iCount > 4)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
iCount++;
|
||||
if (iCount > 4) {
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
int SicsExit(SConnection *pCon, SicsInterp *pInterp, void *pData,
|
||||
int argc, char *argv[])
|
||||
{
|
||||
pTaskMan pTask = NULL;
|
||||
long lID;
|
||||
int SicsExit(SConnection * pCon, SicsInterp * pInterp, void *pData,
|
||||
int argc, char *argv[])
|
||||
{
|
||||
pTaskMan pTask = NULL;
|
||||
long lID;
|
||||
|
||||
assert(pCon);
|
||||
assert(pInterp);
|
||||
|
||||
pTask = GetTasker();
|
||||
assert(pTask);
|
||||
|
||||
if(SCMatchRights(pCon,usMugger)) /* only Muggers are allowed to do it*/
|
||||
{
|
||||
SetInterrupt(eEndServer);
|
||||
lID = TaskRegister(pTask,WaitTask,NULL,NULL,NULL,1);
|
||||
TaskWait(pTask,lID);
|
||||
TaskStop(pTask);
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
SCWrite(pCon,"You are not privileged to close the server",eError);
|
||||
SCWrite(pCon," Get a Manager to do it",eError);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
assert(pCon);
|
||||
assert(pInterp);
|
||||
|
||||
pTask = GetTasker();
|
||||
assert(pTask);
|
||||
|
||||
if (SCMatchRights(pCon, usMugger)) { /* only Muggers are allowed to do it */
|
||||
SetInterrupt(eEndServer);
|
||||
lID = TaskRegister(pTask, WaitTask, NULL, NULL, NULL, 1);
|
||||
TaskWait(pTask, lID);
|
||||
TaskStop(pTask);
|
||||
return 1;
|
||||
} else {
|
||||
SCWrite(pCon, "You are not privileged to close the server", eError);
|
||||
SCWrite(pCon, " Get a Manager to do it", eError);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user