The FreeRADIUS server $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
Loading...
Searching...
No Matches
fd_write.h
Go to the documentation of this file.
1/*
2 * Common finalization code for the write functions.
3 *
4 * This is in a header file because of "goto retry" in fd_errno.h.
5 *
6 * @todo - do we want the callbacks to notify the _previous_ BIO in the chain? That way the top-level
7 * BIO can notify the application.
8 */
9if (rcode > 0) {
10 int error;
11
12 /*
13 * We weren't blocked, but we are now.
14 */
15 if (!my->info.write_blocked) {
16 if ((size_t) rcode == size) {
17 return rcode;
18 }
19
20 fr_assert((size_t) rcode < size);
21
22 /*
23 * Set the flag, and tell the other BIOs that we're blocked.
24 */
25 my->info.write_blocked = true;
26
27 error = fr_bio_write_blocked((fr_bio_t *) my);
28 if (error < 0) return error;
29
30 return rcode;
31 }
32
33 /*
34 * We were blocked. We're still blocked if we wrote _less_ than the amount of requested data.
35 * If we wrote all of the data which was requested, then we're unblocked.
36 */
37 my->info.write_blocked = ((size_t) rcode == size);
38
39 /*
40 * Call the "resume" function if we transitioned to being unblocked.
41 */
42 if (!my->info.write_blocked && my->cb.write_resume) {
43 error = my->cb.write_resume((fr_bio_t *) my);
44 if (error < 0) return error;
45 }
46
47 return rcode;
48}
49
50if (rcode == 0) return rcode;
51
52#undef flag_blocked
53#define flag_blocked write_blocked
54#include "fd_errno.h"
fr_bio_shutdown & my
Definition fd_errno.h:59
int fr_bio_write_blocked(fr_bio_t *bio)
Internal BIO function to tell all BIOs that it's blocked.
Definition base.c:293
unsigned long int size_t
#define fr_assert(_expr)
Definition rad_assert.h:38