Re: Patch: Camel stream filter waits properly for slow streams
José Dapena Paz <[email protected]> Tue, 20 May 2008 18:38:29 +0200
| Newsgroups | gmane.comp.gnome.apps.tinymail.devel,gmane.comp.gnome.evolution.patches,gmane.comp.gnome.evolution.devel |
|---|---|
| Organization | Igalia |
| Message-ID | <[email protected]> |
--=-RRhPgxIMaRmthhbxDVdv Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable El mar, 20-05-2008 a las 17:03 +0200, Philip Van Hoof escribi=C3=B3: > Please bring this upstream too, Jos=C3=A9 >=20 > Response from Jeffrey: >=20 > jeff_ yea, you should compare against -1 > jeff_ as long as it returns >0, it wrote all the data > jeff_ -1 is error > jeff_ 0 is EOF maybe > jeff_ if write even returns 0 ever Ok, prepared patch for camel (it applied without problems). The changelog would be mostly the same: * evolution-data-server/camel/camel-stream-filter.c: (do_write): if the camel_stream_write call does not write the full buffer but it's not due to an error, then loop to go on=20 writing the stream. --=20 Jos=C3=A9 Dapena Paz <[email protected]> Igalia --=-RRhPgxIMaRmthhbxDVdv Content-Disposition: attachment; filename*0=evolution-data-server-trunk-r8817-stream-filter-waits-properl; filename*1=y-for-slow-streams.patch Content-Type: text/x-patch; name*0=evolution-data-server-trunk-r8817-stream-filter-waits-properly-fo; name*1=r-slow-streams.patch; charset=utf-8 Content-Transfer-Encoding: quoted-printable Index: camel/camel-stream-filter.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- camel/camel-stream-filter.c (revisi=C3=B3n: 8817) +++ camel/camel-stream-filter.c (copia de trabajo) @@ -290,6 +290,7 @@ struct _filter *f; size_t presize, len, left =3D n; char *buffer, realbuffer[READ_SIZE+READ_PAD]; + size_t written =3D 0; =20 p->last_was_read =3D FALSE; =20 @@ -321,8 +322,13 @@ f =3D f->next; } =20 - if (camel_stream_write(filter->source, buffer, len) !=3D len) - return -1; + for (written =3D 0; written < len;) { + size_t just_written; + just_written =3D camel_stream_write (filter->source, buffer + written, = len - written); + if (just_written =3D=3D -1) + return -1; + written +=3D just_written; + } } =20 g_check(p->realbuffer); --=-RRhPgxIMaRmthhbxDVdv Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ tinymail-devel-list mailing list [email protected] http://mail.gnome.org/mailman/listinfo/tinymail-devel-list --=-RRhPgxIMaRmthhbxDVdv--