diff --git a/src/lib/bio/fd.c b/src/lib/bio/fd.c index d0b41811de50..dadf3040993c 100644 --- a/src/lib/bio/fd.c +++ b/src/lib/bio/fd.c @@ -728,12 +728,10 @@ static ssize_t fr_bio_fd_try_connect(fr_bio_fd_t *my) */ case EINPROGRESS: if (!my->info.write_blocked) { - if (my->cb.write_blocked) { - rcode = my->cb.write_blocked((fr_bio_t *) my); - if (rcode < 0) return rcode; - } - my->info.write_blocked = true; + + rcode = fr_bio_write_blocked((fr_bio_t *) my); + if (rcode < 0) return rcode; } return fr_bio_error(IO_WOULD_BLOCK); diff --git a/src/lib/bio/fd_write.h b/src/lib/bio/fd_write.h index b4a1b16d18bb..56e3b2499eec 100644 --- a/src/lib/bio/fd_write.h +++ b/src/lib/bio/fd_write.h @@ -24,10 +24,8 @@ if (rcode > 0) { */ my->info.write_blocked = true; - if (my->cb.write_blocked) { - error = fr_bio_write_blocked((fr_bio_t *) my); - if (error < 0) return error; - } + error = fr_bio_write_blocked((fr_bio_t *) my); + if (error < 0) return error; return rcode; } diff --git a/src/lib/bio/mem.c b/src/lib/bio/mem.c index a93341c5a1f5..0a89735a050c 100644 --- a/src/lib/bio/mem.c +++ b/src/lib/bio/mem.c @@ -369,6 +369,7 @@ static ssize_t fr_bio_mem_read_verify_datagram(fr_bio_t *bio, void *packet_ctx, */ static ssize_t fr_bio_mem_write_next(fr_bio_t *bio, void *packet_ctx, void const *buffer, size_t size) { + int error; ssize_t rcode; size_t room, leftover; fr_bio_mem_t *my = talloc_get_type_abort(bio, fr_bio_mem_t); @@ -410,14 +411,13 @@ static ssize_t fr_bio_mem_write_next(fr_bio_t *bio, void *packet_ctx, void const return rcode; } - if (my->cb.write_blocked) { - int error; - - error = my->cb.write_blocked(bio); - if (error < 0) return error; + /* + * Tell previous BIOs in the chain that they are blocked. + */ + error = fr_bio_write_blocked(bio); + if (error < 0) return error; - fr_assert(error != 0); /* what to do? */ - } + fr_assert(error != 0); /* what to do? */ /* * We had WOULD BLOCK, or wrote partial bytes. Save the data to the memory buffer, and ensure diff --git a/src/lib/bio/retry.c b/src/lib/bio/retry.c index 4d6439b8ceb6..36d31b3f36eb 100644 --- a/src/lib/bio/retry.c +++ b/src/lib/bio/retry.c @@ -764,7 +764,10 @@ static ssize_t fr_bio_retry_write(fr_bio_t *bio, void *packet_ctx, void const *b my->info.write_blocked = true; my->all_used = true; - rcode = my->cb.write_blocked(bio); + /* + * Previous BIOs are blocked, but we still try to write retries. + */ + rcode = fr_bio_write_blocked(bio); if (rcode < 0) return rcode; return fr_bio_error(IO_WOULD_BLOCK);