- Removed napi from SICS

- Added error fields to hwardware objects: motor, counter, histmem
- Optimised sinqhttpopt
- Added haddcheck which adds checks to hipadaba nodes. The current implementation
  only checks for selctions agaisnt the values property. Expand when more checks are
  required.
This commit is contained in:
koennecke
2013-08-14 09:50:31 +00:00
parent dba57e55b7
commit 5c3e3a4422
3 changed files with 64 additions and 20 deletions

View File

@ -95,26 +95,52 @@ typedef struct {
int headerReceived;
} HttpProt, *pHttpProt;
/*---------------------------------------------------------------------*/
static int moreToReadThen(Ascon *a, int length)
{
pHttpProt pHttp = NULL;
pHttp = (pHttpProt)a->private;
if(pHttp->headerReceived == 0) {
return 0;
}
if(pHttp->bytesExpected - GetDynStringLength(a->rdBuffer) > length){
return 1;
} else {
return 0;
}
}
/*---------------------------------------------------------------------*/
static int HTTPcallback(int handle, void *userData)
{
Ascon *a = (Ascon *)userData;
pHttpProt pHttp = NULL;
unsigned char ch;
int length;
char *data;
Ascon *a = (Ascon *)userData;
pHttpProt pHttp = NULL;
unsigned char ch;
int length;
char *data;
int blockSize = 65536;
if(a == NULL){
printf("really serious error in HTTPcallback\n");
return 0;
}
pHttp = (pHttpProt)a->private;
if(a == NULL){
printf("really serious error in HTTPcallback\n");
return 0;
}
pHttp = (pHttpProt)a->private;
data = (char *)ANETreadPtr(handle,&length);
if(data != NULL){
DynStringConcatBytes(a->rdBuffer,data,length);
}
ANETreadConsume(handle,length);
return 1;
data = (char *)ANETreadPtr(handle,&length);
if(data != NULL){
/*
This code here should optimize away excessive calls
to memcpy which I have seen in a sysprof test on
SICS @ BOA
*/
if(moreToReadThen(a,blockSize) == 1 && length < blockSize){
// skip
} else {
DynStringConcatBytes(a->rdBuffer,data,length);
ANETreadConsume(handle,length);
}
}
return 1;
}
/*---------------------------------------------------------------------*/
@ -329,6 +355,7 @@ static int processHeader(Ascon *a)
} else {
DynStringClear(a->rdBuffer);
}
DynStringCapacity(a->rdBuffer,pHttp->bytesExpected);
return 1;
}