Aaron Stone wrote:
How is empty body defined? Would that be simply a .\r\n, with nothing at all
before it? It would be obvious to do this:
Yep, only ".\r\n"
/* Find the message terminator. */
if (ringbuf[MOD(ringpos - 1, RING_SIZE)] == '\n'
&& ringbuf[MOD(ringpos - 2, RING_SIZE)] == '\r'
&& ringbuf[MOD(ringpos - 3, RING_SIZE)] == '.'
&& (ringbuf[MOD(ringpos - 4, RING_SIZE)] == '\n'
|| ringbuf[MOD(ringpos - 4), RING_SIZE)] == '\0')) {
But that has the potential to terminate if there's a null at the end of a line
in the middle of a message. What about *mem to see about the length?
/* Find the message terminator. */
if (ringbuf[MOD(ringpos - 1, RING_SIZE)] == '\n'
&& ringbuf[MOD(ringpos - 2, RING_SIZE)] == '\r'
&& ringbuf[MOD(ringpos - 3, RING_SIZE)] == '.'
&& (ringbuf[MOD(ringpos - 4, RING_SIZE)] == '\n'
|| (totalmem < 3 && usedmem < 3)) {
I did this last thing. I used only usedmem, not totalmem. Which is a
mistake.. and will be corrected between now and two minutes :)
Ilja