|
From: | Martin Pala |
Subject: | Re: stuff to work on |
Date: | Fri, 06 Feb 2004 22:45:54 +0100 |
User-agent: | Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040122 Debian/1.6-1 |
Jan-Henrik Haukeland wrote:
Martin Pala <address@hidden> writes:My priority list: 1.) SMTP update (message queue + state machine) 2.) "up" event (ability to notice the bidirectional state transtition)If you take only one of these it would be great. Especially item 2 has been requested by a few.
OK, i will look on it.
Item 1, refactoring the SMTP protocol implementation in sendmail() to use a proper state-machine and implementing a mail queue is going to be a big job, but it will probably be fun and a challenge to implement :-)
Yes :)
What do you think about it?I think the plan sounds good, also if we are going to maintain a queue of mail messages it will probably require that sendmail() runs in itsown thread (because it can take time to process the queue). put mail() --> [mail-queue] -> sendmail-thread(read-&-send-mail)You will need to create a work-queue where the alert handler put mail into a mail queue and sendmail() reads and process mail from the queue. If the queue is empty the sendmail() thread sleeps on a condition variable. Maybe you can use this code for inspiration? http://www.awprofessional.com/catalog/product.asp?product_id={EE21FAD5-7848-4B87-AE8E-A3340E1DD09D} Under the Source Code link, check: workq.c workq.h workq_main.c. The URLs are ridiculous long so I don't pass them here.
Thanks for hints, i will look on it :) I'm currently reading OOC (object oriented C): http://www.planetpdf.com/codecuts/pdfs/ooc.pdf - seems quite interesting.
Martin
[Prev in Thread] | Current Thread | [Next in Thread] |