Build-Depends: debhelper (>= 4), po-debconf, bison, autotools-dev,
libdb-dev, libical-dev (>=0.43), libldap2-dev, gettext, locales,
libpam0g-dev, libsieve2-dev, libssl-dev, libexpat1-dev, libcitadel-dev (>= 7.42),
- libcurl4-openssl-dev | libcurl3-openssl-dev, zlib1g-dev, libev-dev, libc-ares-dev (>= 1.7.2)
+ libcurl4-openssl-dev | libcurl3-openssl-dev, zlib1g-dev, libev-dev (>= 4.0), libc-ares-dev (>= 1.7.2)
Standards-Version: 3.8.0
Package: citadel-server
extern ev_async AddJob;
extern ev_async ExitEventLoop;
+static void
+IO_abort_shutdown_callback(struct ev_loop *loop, ev_cleanup *watcher, int revents)
+{
+ CtdlLogPrintf(CTDL_DEBUG, "EVENT Q: %s\n", __FUNCTION__);
+
+ AsyncIO *IO = watcher->data;
+ IO->ShutdownAbort(IO);
+}
int QueueEventContext(AsyncIO *IO, IO_CallBack CB)
{
h = (IOAddHandler*)malloc(sizeof(IOAddHandler));
h->IO = IO;
h->EvAttch = CB;
+ ev_cleanup_init(&IO->abort_by_shutdown,
+ IO_abort_shutdown_callback);
+ IO->abort_by_shutdown.data = IO;
+ ev_cleanup_start(event_base, &IO->abort_by_shutdown);
citthread_mutex_lock(&EventQueueMutex);
CtdlLogPrintf(CTDL_DEBUG, "EVENT Q\n");
int sock;
unsigned short dport;
eNextState NextState;
+
+ ev_cleanup abort_by_shutdown;
ev_timer conn_fail,
rw_timeout,
SendDone, /* we may send more data */
Terminate, /* shutting down... */
Timeout, /* Timeout handler; may also be connection timeout */
- ConnFail; /* What to do when one connection failed? */
+ ConnFail, /* What to do when one connection failed? */
+ ShutdownAbort;/* we're going down. make your piece. */
IO_LineReaderCallback LineReader; /* if we have linereaders, maybe we want to read more lines before the real application logic is called? */
free(Msg);
}
+eNextState SMTP_C_Shutdown(AsyncIO *IO);
eNextState SMTP_C_Timeout(AsyncIO *IO);
eNextState SMTP_C_ConnFail(AsyncIO *IO);
eNextState SMTP_C_DispatchReadDone(AsyncIO *IO);
SendMsg->MyQItem = MyQItem;
SendMsg->pCurrRelay = MyQItem->URL;
- SendMsg->IO.dport = DefaultMXPort;
- SendMsg->IO.Data = SendMsg;
- SendMsg->IO.SendDone = SMTP_C_DispatchWriteDone;
- SendMsg->IO.ReadDone = SMTP_C_DispatchReadDone;
- SendMsg->IO.Terminate = SMTP_C_Terminate;
- SendMsg->IO.LineReader = SMTP_C_ReadServerStatus;
- SendMsg->IO.ConnFail = SMTP_C_ConnFail;
- SendMsg->IO.Timeout = SMTP_C_Timeout;
- SendMsg->IO.SendBuf.Buf = NewStrBufPlain(NULL, 1024);
- SendMsg->IO.RecvBuf.Buf = NewStrBufPlain(NULL, 1024);
- SendMsg->IO.IOBuf = NewStrBuf();
+ SendMsg->IO.dport = DefaultMXPort;
+ SendMsg->IO.Data = SendMsg;
+ SendMsg->IO.SendDone = SMTP_C_DispatchWriteDone;
+ SendMsg->IO.ReadDone = SMTP_C_DispatchReadDone;
+ SendMsg->IO.Terminate = SMTP_C_Terminate;
+ SendMsg->IO.LineReader = SMTP_C_ReadServerStatus;
+ SendMsg->IO.ConnFail = SMTP_C_ConnFail;
+ SendMsg->IO.Timeout = SMTP_C_Timeout;
+ SendMsg->IO.ShutdownAbort = SMTP_C_Shutdown;
+ SendMsg->IO.SendBuf.Buf = NewStrBufPlain(NULL, 1024);
+ SendMsg->IO.RecvBuf.Buf = NewStrBufPlain(NULL, 1024);
+ SendMsg->IO.IOBuf = NewStrBuf();
+
if (KeepMsgText) {
SendMsg->msgtext = MsgText;
FinalizeMessageSend(pMsg);
return eAbort;
}
+eNextState SMTP_C_Shutdown(AsyncIO *IO)
+{
+ CtdlLogPrintf(CTDL_DEBUG, "SMTP: %s\n", __FUNCTION__);
+ SmtpOutMsg *pMsg = IO->Data;
+
+ pMsg->MyQEntry->Status = 3;
+ StrBufPlain(pMsg->MyQEntry->StatusMessage, HKEY("server shutdown during message submit."));
+ FinalizeMessageSend(pMsg);
+ return eAbort;
+}
/**