Assorted bug fixes

- In network.c and asynnet.c code was added to close the socket when a
  connect failed. Otherwise the socket would leak and the process
  runs out of file descriptors.
- Multicountserc now forcefully handles the counting status. Before I had
  the status flickering between counting and nobeam because the HM has no way to
  diagnose nobeam
- In motorsec.c the pDrivInt->iErrorCount was not reset to 0 properly. Leading to death.
- Removed the stack smashing test flag for the time being.
This commit is contained in:
2014-05-21 09:58:23 +02:00
parent 325fc6f313
commit 4f5bcaeb5e
6 changed files with 16 additions and 2 deletions

View File

@ -247,6 +247,7 @@ int ANETconnect(char *name, int iPort)
status = connect(socke, (struct sockaddr *) &addresse,
sizeof(struct sockaddr_in));
if (status < 0) {
close(socke);
anetLog(ANETERROR, "Failed to open socket to %s:%d", name, iPort);
return ANETOPENFAIL;
}

View File

@ -235,9 +235,11 @@ static int DriveTaskFunc(void *data)
DevexecLog("STOP",taskData->name);
if(status == HWIdle || status == OKOK){
ExeInterest(pServ->pExecutor,taskData->name, "finished");
} else {
ExeInterest(pServ->pExecutor,taskData->name, "finished with problem");
}
SetStatus(eEager);
return 0;
}
/*--------------------------------------------------------------------------*/

View File

@ -509,6 +509,7 @@ static hdbCallbackReturn SecMotorCallback(pHdb node, void *userData,
self->name);
SCWrite(pCon, pBueffel, eWarning);
self->errorCount = 0;
self->pDrivInt->iErrorCount = 0;
}
/*

View File

@ -15,6 +15,7 @@
#include <counter.h>
#include <stptok.h>
#include <macro.h>
#include <status.h>
#include "sicshipadaba.h"
/*---------------------------------------------------------------------------*/
typedef struct {
@ -313,14 +314,20 @@ static int isMultiMasterRunning(pCounter self, SConnection *pCon, int *status)
UpdateHipadabaPar(stopTime,MakeHdbInt(time(NULL)),pCon);
SecCounterSetError(self,"Master counter errror");
*status = HWBusy;
ClearFixedStatus(eCounting);
break;
case HWPause:
UpdateHipadabaPar(myStatus,MakeHdbText("paused"),pCon);
*status = HWPause;
SetStatusFixed(ePaused);
break;
case HWNoBeam:
UpdateHipadabaPar(myStatus,MakeHdbText("nobeam"),pCon);
*status = HWNoBeam;
SetStatusFixed(eOutOfBeam);
break;
default:
SetStatusFixed(eCounting);
*status = HWBusy;
UpdateHipadabaPar(myStatus,MakeHdbText("run"),pCon);
if (self->iCallbackCounter > 20) {
@ -403,6 +410,7 @@ static void multiEndCounting(pCounter self, SConnection *pCon)
InvokeCallBack(self->pCall, COUNTEND, NULL);
ReleaseCountLock(self->pCountInt);
MultiSecTransfer(self,pCon);
ClearFixedStatus(eEager);
}
/*-------------------------------------------------------------------------------------*/
@ -420,11 +428,12 @@ static int MultiSecStatus(void *pData, SConnection * pCon)
}
if(areSlavesRunning(self,pCon, &status)){
SetStatusFixed(eCounting);
return status;
}
multiEndCounting(self,pCon);
return HWIdle;
}
/*---------------------------------------------------------------------------

View File

@ -288,6 +288,7 @@ mkChannel *NETConnectWithFlags(char *name, int port, int flags)
iRet = connect(pRes->sockid, (struct sockaddr *) &(pRes->adresse),
sizeof(struct sockaddr_in));
if (iRet < 0) {
close(pRes->sockid);
if (errno != EINPROGRESS) {
free(pRes);
return NULL;

View File

@ -12,4 +12,4 @@ MFLAGS=-f makefile_linux$(DUMMY)
HDFROOT=/afs/psi.ch/project/sinq/sl6
TCLINC=.
DBG= -g -fstack-protector-all
DBG= -g