diff options
author | Andre Lorbach <alorbach@adiscon.com> | 2012-08-25 12:08:08 -0700 |
---|---|---|
committer | Andre Lorbach <alorbach@adiscon.com> | 2012-08-25 12:08:08 -0700 |
commit | 88faed212c045cd53671155bd4af8a606b08b706 (patch) | |
tree | 743b04724a0625c177ec67df7788235539b7d44b /tools | |
parent | d3173826268b18d38d67525d8d38083176742c8c (diff) | |
download | rsyslog-88faed212c045cd53671155bd4af8a606b08b706.tar.gz rsyslog-88faed212c045cd53671155bd4af8a606b08b706.tar.bz2 rsyslog-88faed212c045cd53671155bd4af8a606b08b706.zip |
Fixed TCP CheckConnection handling in omfwd.c.
Interface needed to be changed in lower stream classes. Syslog TCP Sending is now resumed properly.
Diffstat (limited to 'tools')
-rw-r--r-- | tools/omfwd.c | 11 |
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); } |