mirror of
git://erdgeist.org/opentracker
synced 2025-04-13 08:31:17 +08:00
Reflect changes in iovec code in sync code
This commit is contained in:
parent
616302c139
commit
afcef0537c
19
ot_sync.c
19
ot_sync.c
@ -96,19 +96,10 @@ static void sync_make( int *iovec_entries, struct iovec **iovector ) {
|
|||||||
/* If we reached our low watermark in buffer... */
|
/* If we reached our low watermark in buffer... */
|
||||||
if( re - r <= (ssize_t)(/* strlen( "20:" ) == */ 3 + sizeof( ot_hash ) + /* strlen_max( "%zd" ) == */ 12 + byte_count ) ) {
|
if( re - r <= (ssize_t)(/* strlen( "20:" ) == */ 3 + sizeof( ot_hash ) + /* strlen_max( "%zd" ) == */ 12 + byte_count ) ) {
|
||||||
|
|
||||||
/* crop current output buffer to the amount really used */
|
/* Allocate a fresh output buffer at the end of our buffers list
|
||||||
iovec_fixlast( iovec_entries, iovector, OT_SYNC_CHUNK_SIZE - ( re - r ) );
|
release bucket and return, if that fails */
|
||||||
|
if( !( r = iovec_fix_increase_or_free( iovec_entries, iovector, r, OT_SYNC_CHUNK_SIZE ) ) )
|
||||||
/* And allocate a fresh output buffer at the end of our buffers list */
|
return mutex_bucket_unlock( bucket );
|
||||||
if( !( r = iovec_increase( iovec_entries, iovector, OT_SYNC_CHUNK_SIZE ) ) ) {
|
|
||||||
|
|
||||||
/* If this fails: free buffers */
|
|
||||||
iovec_free( iovec_entries, iovector );
|
|
||||||
|
|
||||||
/* Release lock on current bucket and return */
|
|
||||||
mutex_bucket_unlock( bucket );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Adjust new end of output buffer */
|
/* Adjust new end of output buffer */
|
||||||
re = r + OT_SYNC_CHUNK_SIZE;
|
re = r + OT_SYNC_CHUNK_SIZE;
|
||||||
@ -128,7 +119,7 @@ static void sync_make( int *iovec_entries, struct iovec **iovector ) {
|
|||||||
*r++='e'; *r++='e';
|
*r++='e'; *r++='e';
|
||||||
|
|
||||||
/* Release unused memory in current output buffer */
|
/* Release unused memory in current output buffer */
|
||||||
iovec_fixlast( iovec_entries, iovector, OT_SYNC_CHUNK_SIZE - ( re - r ) );
|
iovec_fixlast( iovec_entries, iovector, r );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This is the entry point into this worker thread
|
/* This is the entry point into this worker thread
|
||||||
|
Loading…
x
Reference in New Issue
Block a user