make shutdown more proper (releasing all memory)

This commit is contained in:
zolliker
2005-09-02 13:57:14 +00:00
parent 2e1778abb7
commit 9a051e8289
4 changed files with 30 additions and 12 deletions

View File

@ -177,7 +177,7 @@
TaskRegister(self->pTasker,
NetReaderTask,
NetReaderSignal,
DeleteNetReader,
NULL, /* call DeleteNetReader later than TaskerDelete */
pReader,1);
self->pReader = pReader;
@ -187,24 +187,24 @@
{
printf("Cannot find ServerPort number in options file %s\n",
"This value is required!");
IFDeleteOptions(pSICSOptions);
DeleteInterp(self->pSics);
IFDeleteOptions(pSICSOptions);
return 0;
}
iRet = sscanf(pText,"%d",&iPort);
if( (iRet != 1) || (iPort < 1024) )
{
printf("Invalid port number specified in Server initialisation file\n");
IFDeleteOptions(pSICSOptions);
DeleteInterp(self->pSics);
IFDeleteOptions(pSICSOptions);
return 0;
}
self->pServerPort = NETOpenPort(iPort);
if(!self->pServerPort)
{
printf("Cannot open Server Socket\n");
IFDeleteOptions(pSICSOptions);
DeleteInterp(self->pSics);
IFDeleteOptions(pSICSOptions);
return 0;
}
NetReadRegister(pReader, self->pServerPort, naccept, NULL);
@ -222,16 +222,16 @@
{
printf("Cannot find InterruptPort number in options file %s\n",
"This value is required!");
IFDeleteOptions(pSICSOptions);
DeleteInterp(self->pSics);
IFDeleteOptions(pSICSOptions);
return 0;
}
iRet = sscanf(pText,"%d",&iPort);
if( (iRet != 1) || (iPort < 1024) )
{
printf("Invalid port number specified in Server initialisation file\n");
IFDeleteOptions(pSICSOptions);
DeleteInterp(self->pSics);
IFDeleteOptions(pSICSOptions);
return 0;
}
iRet = ServerSetupInterrupt(iPort,pReader,self->pTasker);
@ -310,7 +310,6 @@
/* shut tasker down */
TaskerDelete(&self->pTasker);
self->pTasker = NULL;
self->pReader = NULL;
/* save status */
if(!self->simMode)
@ -345,14 +344,20 @@
}
/* clean out */
if(pSICSOptions)
IFDeleteOptions(pSICSOptions);
if(self->pSics)
{
DeleteInterp(self->pSics);
self->pSics = NULL;
}
/* remove options after interpreter as some object kill functions
may use options */
if(pSICSOptions)
IFDeleteOptions(pSICSOptions);
/* delete net reader */
DeleteNetReader(self->pReader);
self->pReader = NULL;
/* close the server port */
if(self->pServerPort)
{
@ -388,11 +393,15 @@
/* close the List system */
LLDsystemClose();
KillFreeConnections();
/* make fortify print his findings */
Fortify_DumpAllMemory(iFortifyScope);
Fortify_LeaveScope();
free(self);
}
/*------------------------------------------------------------------------*/
void RunServer(pServer self)