- Introduced a new trace facility

- Fixed performance problems in many protocol drivers.


SKIPPED:
	psi/julprot.c
	psi/phytron.c
	psi/pmacprot.c
	psi/polterwrite.c
	psi/spss7.c
This commit is contained in:
koennecke
2011-06-29 07:53:54 +00:00
parent 9abb3584f1
commit 3ee1865f9b
31 changed files with 868 additions and 35 deletions

View File

@ -114,7 +114,20 @@ static char *ConName(long ident)
snprintf(name, sizeof(name), "CON%ld", ident);
return name;
}
/*--------------------------------------------------------------------------*/
char *ConID(SConnection *pCon)
{
static char id[132];
char host[80];
if(ANETvalidHandle(pCon->sockHandle)){
ANETinfo(pCon->sockHandle, host, sizeof(host));
snprintf(id,sizeof(id),"%s:%2.2d", host, pCon->sockHandle);
} else {
snprintf(id,sizeof(id),"disconnected:%2.2ld", pCon->ident);
}
return id;
}
/*--------------------------------------------------------------------------*/
static void FreeConnection(SConnection * pCon)
{
@ -576,6 +589,9 @@ int SCWrite(SConnection * self, char *pBuffer, int iOut)
if (pBuffer == NULL) {
return 0;
}
if(!SCinMacro(self)){
traceCommand(ConID(self),"out:%s", pBuffer);
}
return self->write(self, pBuffer, iOut);
}
@ -1033,6 +1049,9 @@ int SCWriteUUencoded(SConnection * pCon, char *pName, void *pData,
ANETwrite(pCon->sockHandle, pPtr, iLength);
}
traceCommand(ConID(pCon),"out:UUData %s %d", pName, iLength);
#ifdef UUDEB
fd = fopen("uubuffer.uu", "w");
fputs(pPtr, fd);
@ -1133,6 +1152,8 @@ int SCWriteZipped(SConnection * self, char *pName, void *pData,
SCWrite(self, "ERROR: out of memory in SCWriteZipped", eError);
return 0;
}
traceCommand(ConID(self),"out:SICSBIN ZIP %s %d", pName, compressedLength);
/* now reset the deflater and do the same with writing data */
compStream.zalloc = (alloc_func) NULL;
@ -1411,6 +1432,7 @@ int SCInvoke(SConnection * self, SicsInterp * pInter, char *pCommand)
}
strlcpy(pCopy->deviceID, pBueffel, SCDEVIDLEN);
/* SCAdvanceContext(self,pBueffel); */
traceCommand(ConID(self),"in:%s", pCommand);
iRet = InterpExecute(pInter, pCopy, pCommand);
/* SCPopContext(self); */
SCDeleteConnection(pCopy);