summaryrefslogtreecommitdiffstats
path: root/tools/omfwd.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/omfwd.c')
-rw-r--r--tools/omfwd.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/tools/omfwd.c b/tools/omfwd.c
index 2a19aae4..b4a28c34 100644
--- a/tools/omfwd.c
+++ b/tools/omfwd.c
@@ -314,7 +314,7 @@ TCPSendBuf(instanceData *pData, uchar *buf, unsigned len)
ssize_t lenSend;
alreadySent = 0;
- netstrm.CheckConnection(pData->pNetstrm); /* hack for plain tcp syslog - see ptcp driver for details */
+ CHKiRet(netstrm.CheckConnection(pData->pNetstrm)); /* hack for plain tcp syslog - see ptcp driver for details */
while(alreadySent != len) {
lenSend = len - alreadySent;
CHKiRet(netstrm.Send(pData->pNetstrm, buf+alreadySent, &lenSend));
@@ -323,6 +323,12 @@ TCPSendBuf(instanceData *pData, uchar *buf, unsigned len)
}
finalize_it:
+ if(iRet != RS_RET_OK) {
+ /* error! */
+ dbgprintf("TCPSendBuf error %d, destruct TCP Connection!\n", iRet);
+ DestructTCPInstanceData(pData);
+ iRet = RS_RET_SUSPENDED;
+ }
RETiRet;
}
@@ -367,6 +373,7 @@ static rsRetVal TCPSendPrepRetry(void *pvData)
{
DEFiRet;
instanceData *pData = (instanceData *) pvData;
+dbgprintf("TCPSendPrepRetry performs a DestructTCPInstanceData\n");
assert(pData != NULL);
DestructTCPInstanceData(pData);
@@ -384,6 +391,7 @@ static rsRetVal TCPSendInit(void *pvData)
assert(pData != NULL);
if(pData->pNetstrm == NULL) {
+ dbgprintf("TCPSendInit CREATE\n");
CHKiRet(netstrms.Construct(&pData->pNS));
/* the stream driver must be set before the object is finalized! */
CHKiRet(netstrms.SetDrvrName(pData->pNS, pData->pszStrmDrvr));
@@ -407,6 +415,7 @@ static rsRetVal TCPSendInit(void *pvData)
finalize_it:
if(iRet != RS_RET_OK) {
+ dbgprintf("TCPSendInit FAILED with %d.\n", iRet);
DestructTCPInstanceData(pData);
}