The FreeRADIUS server $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
Loading...
Searching...
No Matches
fd_errno.h
Go to the documentation of this file.
1/*
2 * We have an error, so we have common error handling code.
3 */
4switch (errno) {
5case EINTR:
6 /*
7 * Try a few times before giving up.
8 */
9 tries++;
10 if (tries <= my->max_tries) goto retry;
11 return 0;
12
13#if defined(EWOULDBLOCK) && (EWOULDBLOCK != EAGAIN)
14case EWOULDBLOCK:
15#endif
16case EAGAIN:
17 /*
18 * The operation would block, return that.
19 */
20 if (!my->info.flag_blocked) {
21 my->info.flag_blocked = true;
22
23 if (my->cb.flag_blocked) {
24 rcode = my->cb.flag_blocked((fr_bio_t *) my);
25 if (rcode < 0) return rcode;
26 }
27 }
28 return fr_bio_error(IO_WOULD_BLOCK);
29
30 /*
31 * We're reading / writing a connected UDP socket, and the other end has gone away.
32 */
33case ENOTCONN:
34
35 /*
36 * The other end of a socket has closed the connection.
37 */
38case ECONNRESET:
39
40 /*
41 * The other end of a pipe has closed the connection.
42 */
43case EPIPE:
44 /*
45 * The connection is no longer usable, close it.
46 */
47 fr_bio_eof(&my->bio);
48 return 0;
49
50#ifdef FR_FD_BIO_EMSGSIZE
51 /*
52 * PMTU has been exceeded. Return a generic IO error.
53 *
54 * @todo - do this only for connected UDP sockets.
55 */
56 case EMSGSIZE:
57 return fr_bio_error(IO);
58#endif
59
60default:
61 /*
62 * Some other error, it's fatal.
63 */
64 break;
65}
66
67/*
68 * Shut down the BIO. It's no longer useable.
69 */
#define fr_bio_error(_x)
Definition base.h:192
fr_bio_shutdown & my
Definition fd_errno.h:70
void fr_bio_eof(fr_bio_t *bio)
Internal BIO function to run EOF callbacks.
Definition base.c:242
int fr_bio_shutdown(fr_bio_t *bio)
Shut down a set of BIOs.
Definition base.c:141