Commit e105df67 e105df67dcc3f11787259c6334e68a9dabb167c1 by Sergey Poznyakoff

Bugfix.

* examples/http.c (main): Fix open/wait loop.
* libmailutils/stream.c (mu_stream_wait): May be used
on not-open streams.
* examples/.gitignore: Add more files.
1 parent aa082652
......@@ -15,8 +15,10 @@ mimetest
msg-send
mta
muauth
mucat
muemail
murun
musocio
nntpclient
pop3client
sfrom
......
......@@ -99,12 +99,14 @@ main (int argc, char **argv)
for (attempt = 0; ret; )
{
ret = mu_stream_open (stream);
if ((ret == EAGAIN || ret == EINPROGRESS) && attempt < io_attempts)
{
ret = http_stream_wait(stream, MU_STREAM_READY_WR, &attempt);
if (ret == 0)
continue;
{
ret = mu_stream_open (stream);
continue;
}
}
mu_error ("mu_stream_open: %s", mu_strerror (ret));
exit (EXIT_FAILURE);
......
......@@ -1071,14 +1071,18 @@ mu_stream_wait (mu_stream_t stream, int *pflags, struct timeval *tvp)
if (stream == NULL)
return EINVAL;
#if 0
/* NOTE: Sometimes mu_stream_wait is called after a failed mu_stream_open.
In particular, this is needed for a TCP stream opened with a
MU_STREAM_NONBLOCK flag (see examples/http.c). Until a better
solution is found, this check is commented out. */
if (!(stream->flags & _MU_STR_OPEN))
{
if (stream->open)
return MU_ERR_NOT_OPEN;
_stream_init (stream);
}
#endif
/* Take to acount if we have any buffering. */
/* FIXME: How about MU_STREAM_READY_WR? */
if ((*pflags) & MU_STREAM_READY_RD
......