Another try ad getting write to work

This commit is contained in:
2015-03-19 16:12:35 +01:00
parent 0097a2f3cb
commit 0d0c90cee7
4 changed files with 38 additions and 5 deletions

View File

@ -240,8 +240,9 @@ static void ConnectRemoteObject(pRemoteOBJ self)
status = LLDnodePtr2Next(self->readList);
}
transactCommand(self->writeHandle,"protocol set withcode\r\n", command,sizeof(command));
transactCommand(self->writeHandle,"protocol set withcode\r\n", command,sizeof(command)-1);
transactCommand(self->writeHandle,"config remote\r\n",command,sizeof(command)-1);
self->connected = 1;
self->writeInUse = 0;
}
@ -537,7 +538,7 @@ static void printSICS(char *answer, SConnection *pCon)
while(pPtr != NULL){
memset(line,0,sizeof(line));
pPtr = stptok(pPtr,line,sizeof(line),"\n");
if(strstr(line,"OK") == NULL){
if(strstr(line,"OK") == NULL && strstr(line,"TASKFINISHED") == NULL){
pCode = strstr(line,"@@");
if(pCode != NULL){
*pCode = '\0';
@ -578,6 +579,7 @@ static int PrepareWriteHandle(pRemoteOBJ self, SConnection *pCon, int *newHandle
*newHandle = 1;
transactCommand(handle,"protocol set withcode\r\n", command,sizeof(command));
transactCommand(handle,"config remote\r\n",command,sizeof(command)-1);
} else {
self->writeInUse = 1;
@ -609,7 +611,7 @@ static void ProcessWriteResponse(pRemoteOBJ self, int handle, SConnection *pCon)
printSICS(answer,pCon);
}
traceIO("RO","%s:%d: Received %s", self->host, self->port,answer);
ANETreadConsume(handle,length);
ANETreadConsume(handle,pEnd+strlen("TRANSACTIONFINISHED") - answer);
break;
}
}
@ -688,6 +690,23 @@ static hdbCallbackReturn ROWriteCallback(pHdb currentNode, void *userData,
}
}
/*
Do I have to wait for a TASKFINISHED?
*/
command = GetHdbProp(currentNode,"taskwait");
if(command != NULL){
while(1) {
TaskYield(pServ->pTasker);
answer = ANETreadPtr(handle,&length);
if(length > 0 && strstr(answer,"TASKFINISHED") != NULL){
printSICS(answer,pCon);
traceIO("RO","%s:%d:Received %s", self->host,self->port,answer);
ANETreadConsume(handle,length);
break;
}
}
}
if(newHandle){
ANETclose(handle);