summaryrefslogtreecommitdiffstats
path: root/syslogd.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2007-07-26 08:42:14 +0000
committerRainer Gerhards <rgerhards@adiscon.com>2007-07-26 08:42:14 +0000
commitc75d3b93480469abfd2cb8332bcc0e58c95ef5e3 (patch)
treec2e9041e09276e8960f2cc96b580b5cb78283376 /syslogd.c
parent229aa9e64424cf05fc2391ad2e7e2baefc37542f (diff)
downloadrsyslog-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 'syslogd.c')
-rw-r--r--syslogd.c24
1 files changed, 7 insertions, 17 deletions
diff --git a/syslogd.c b/syslogd.c
index dae93362..d9d04bb2 100644
--- a/syslogd.c
+++ b/syslogd.c
@@ -4032,7 +4032,6 @@ static void freeSelectors(void)
selector_t *f;
selector_t *fPrev;
- Initialized = 0;
if(Files != NULL) {
dprintf("Freeing log structures.\n");
@@ -4073,6 +4072,7 @@ static void freeSelectors(void)
/* Reflect the deletion of the selectors linked list. */
Files = NULL;
+ Initialized = 0;
}
}
@@ -5372,24 +5372,14 @@ static void mainloop(void)
* this code here will stay for quite a while.
* rgerhards, 2006-12-07
*/
+ short fdMod;
+ rsRetVal iRet;
for (f = Files; f != NULL ; f = f->f_next) {
- if( (f->f_type == F_FORW)
- && (f->f_un.f_forw.protocol == FORW_TCP)
- && (TCPSendGetStatus(f) == TCP_SEND_CONNECTING)
- && (FD_ISSET(f->f_file, &writefds))) {
- 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...");
+ if(f->pMod->getWriteFDForSelect(f, f->pModData, &fdMod) == RS_RET_OK) {
+ if(FD_ISSET(f->f_file, &writefds)) {
+ if((iRet = f->pMod->onSelectReadyWrite(f, f->pModData)) != RS_RET_OK) {
+ dprintf("error %d from onSelectReadyWrite() - continuing\n", iRet);
}
- free(f->f_un.f_forw.savedMsg);
- f->f_un.f_forw.savedMsg = NULL;
}
}
}