# HG changeset patch # User William Pitcock # Date 1241674211 18000 # Node ID f8686c591e495b39e411ab703fc98d9c1d00135c # Parent 3c445626fcc8da315f59fd7338364f9498943d6e neon: More gracefully handle the NEON_READER_ERROR condition. diff -r 3c445626fcc8 -r f8686c591e49 src/neon/neon.c --- a/src/neon/neon.c Thu May 07 06:24:49 2009 +0200 +++ b/src/neon/neon.c Thu May 07 00:30:11 2009 -0500 @@ -1043,6 +1043,17 @@ * All is well, nothing to be done. */ break; + case NEON_READER_ERROR: + /* + * A reader error happened. Log it, and treat it like an EOF condition, by falling through + * to the NEON_READER_EOF codepath. --nenolod + */ + _DEBUG("<%p> NEON_READER_ERROR happened. Terminating reader thread and marking EOF.", h); + h->reader_status.status = NEON_READER_EOF; + + if (NULL != h->reader) + kill_reader(h); + case NEON_READER_EOF: /* * If there still is data in the buffer, carry on. @@ -1051,17 +1062,14 @@ if (0 == used_rb_locked(&h->rb)) { _DEBUG("<%p> Reached end of stream", h); g_mutex_unlock(h->reader_status.mutex); - kill_reader(h); + + if (NULL != h->reader) + kill_reader(h); + h->eof = TRUE; _LEAVE 0; } break; - case NEON_READER_ERROR: - /* Terminate the reader and return 0 */ - g_mutex_unlock(h->reader_status.mutex); - kill_reader(h); - _LEAVE 0; - break; case NEON_READER_TERM: /* * The reader thread terminated gracefully, most