Profiling nnrpd (was Re: Observation using trn-test76 and INN 2.4.0)

Russ Allbery rra at stanford.edu
Thu Nov 28 17:40:26 UTC 2002


Jeffrey M Vinocur <jeff at litech.org> writes:

> The mind boggles.  We get near the end of CMDxover() and it executes 

>         SendIOv(".\r\n", 3);
>         PushIOv();

> and if I query the vector after the first line above, the .CRLF has been 
> put in the queue successfully.

> (gdb) p queued_iov
> $5 = 772
> (gdb) p iov[771]
> $6 = {iov_base = 0x817285f, iov_len = 3}
> (gdb) p (char*)iov[771].iov_base
> $7 = 0x817285f ".\r\n"

> Yet somehow the PushIOv() doesn't result in that being written.  (The 
> return value was positive, by the way, although we don't check it.)

It was using writev rather than xwritev, so it wasn't finishing partial
writes.  *sigh*  I can't believe that's been there for so long.

Here's the patch.  Applying now.

diff -u -p -r1.124 article.c
--- article.c   2002/09/30 03:27:59     1.124
+++ article.c   2002/11/28 17:40:12
@@ -63,9 +63,9 @@ static bool PushIOvHelper(struct iovec* 
 #ifdef HAVE_SSL
     result = tls_conn
             ? SSL_writev(tls_conn, vec, *countp)
-            : writev(STDOUT_FILENO, vec, *countp);
+            : xwritev(STDOUT_FILENO, vec, *countp);
 #else
-    result = writev(STDOUT_FILENO, vec, *countp);
+    result = xwritev(STDOUT_FILENO, vec, *countp);
 #endif
     *countp = 0;
     return (result <= 0 ? FALSE : TRUE);

-- 
Russ Allbery (rra at stanford.edu)             <http://www.eyrie.org/~eagle/>

    Please send questions to the list rather than mailing me directly.
     <http://www.eyrie.org/~eagle/faqs/questions.html> explains why.


More information about the inn-workers mailing list