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, status = connect(socke, (struct sockaddr *) &addresse,
sizeof(struct sockaddr_in)); sizeof(struct sockaddr_in));
if (status < 0) { if (status < 0) {
close(socke);
anetLog(ANETERROR, "Failed to open socket to %s:%d", name, iPort); anetLog(ANETERROR, "Failed to open socket to %s:%d", name, iPort);
return ANETOPENFAIL; return ANETOPENFAIL;
} }

View File

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

View File

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

View File

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

View File

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

View File

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