diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2007-07-26 08:42:14 +0000 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2007-07-26 08:42:14 +0000 |
commit | c75d3b93480469abfd2cb8332bcc0e58c95ef5e3 (patch) | |
tree | c2e9041e09276e8960f2cc96b580b5cb78283376 /omfwd.c | |
parent | 229aa9e64424cf05fc2391ad2e7e2baefc37542f (diff) | |
download | rsyslog-c75d3b93480469abfd2cb8332bcc0e58c95ef5e3.tar.gz rsyslog-c75d3b93480469abfd2cb8332bcc0e58c95ef5e3.tar.xz rsyslog-c75d3b93480469abfd2cb8332bcc0e58c95ef5e3.zip |
- implemented onSelectReadyWrite() interface
- milestone reached: no more access to f->f_un in syslogd.c
Diffstat (limited to 'omfwd.c')
-rw-r--r-- | omfwd.c | 22 |
1 files changed, 22 insertions, 0 deletions
@@ -1,6 +1,9 @@ /* omfwd.c * This is the implementation of the build-in forwarding output module. * + * NOTE: read comments in module-template.h to understand how this file + * works! + * * File begun on 2007-07-20 by RGerhards (extracted from syslogd.c) * This file is under development and has not yet arrived at being fully * self-contained and a real object. So far, it is mostly an excerpt @@ -475,6 +478,25 @@ CODESTARTparseSelectorAct ENDparseSelectorAct +BEGINonSelectReadyWrite +CODESTARTonSelectReadyWrite + dprintf("tcp send socket %d ready for writing.\n", f->f_file); + TCPSendSetStatus(f, TCP_SEND_READY); + /* Send stored message (if any) */ + if(f->f_un.f_forw.savedMsg != NULL) { + if(TCPSend(f, f->f_un.f_forw.savedMsg, + f->f_un.f_forw.savedMsgLen) != 0) { + /* error! */ + f->f_type = F_FORW_SUSP; + errno = 0; + logerror("error forwarding via tcp, suspending..."); + } + free(f->f_un.f_forw.savedMsg); + f->f_un.f_forw.savedMsg = NULL; + } +ENDonSelectReadyWrite + + BEGINgetWriteFDForSelect CODESTARTgetWriteFDForSelect if( (f->f_type == F_FORW) |