commit c9b8cefc298d97ecba67def56a375c91485cd92f
Author: Oswald Buddenhagen <[email protected]>
Date:   Sat Feb 14 13:30:14 2015 +0100

    handle clean shutdown of zlib stream
    
    the server can actually close the zlib stream before closing the socket,
    so we need to accept it.
    
    we don't do anything beyond that - the actual EOF will be signaled by
    the socket, and if the server (erroneously) sends more data, zlib will
    tell us about it.
    
    REFMAIL: [email protected]

 src/socket.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/socket.c b/src/socket.c
index b376d73..3c4a3cd 100644
--- a/src/socket.c
+++ b/src/socket.c
@@ -597,7 +597,7 @@ static void
 socket_fill_z( conn_t *sock )
 {
        char *buf;
-       int len;
+       int len, ret;
 
        if (prepare_read( sock, &buf, &len ) < 0)
                return;
@@ -605,7 +605,8 @@ socket_fill_z( conn_t *sock )
        sock->in_z->avail_out = len;
        sock->in_z->next_out = (unsigned char *)buf;
 
-       if (inflate( sock->in_z, Z_SYNC_FLUSH ) != Z_OK) {
+       ret = inflate( sock->in_z, Z_SYNC_FLUSH );
+       if (ret != Z_OK && ret != Z_STREAM_END) {
                error( "Error decompressing data from %s: %s\n", sock->name, 
sock->in_z->msg );
                socket_fail( sock );
                return;

------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
isync-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/isync-devel

Reply via email to