The FreeRADIUS server  $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
fd_errno.h
Go to the documentation of this file.
1 /*
2  * We have an error, so we have common error handling code.
3  */
4 switch (errno) {
5 case 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)
14 case EWOULDBLOCK:
15 #endif
16 case 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 #ifndef NDEBUG
31 case ENOTCONN:
32  /*
33  * We're doing a read/write to a socket which isn't connected. This is a failure of the
34  * application state machine.
35  */
36  fr_assert(0);
37  break;
38 #endif
39 
40 case ECONNRESET:
41 case EPIPE:
42  /*
43  * The other end closed the connection, signal the application that it's a (maybe) clean close,
44  * and set EOF on the BIO.
45  */
46  fr_bio_eof(&my->bio);
47  return 0;
48 
49 default:
50  /*
51  * Some other error, it's fatal.
52  */
53  break;
54 }
55 
56 /*
57  * Shut down the BIO. It's no longer useable.
58  */
#define fr_bio_error(_x)
Definition: base.h:192
Definition: base.h:112
fr_bio_shutdown & my
Definition: fd_errno.h:59
void fr_bio_eof(fr_bio_t *bio)
Internal BIO function to run EOF callbacks.
Definition: base.c:244
int fr_bio_shutdown(fr_bio_t *bio)
Shut down a set of BIOs.
Definition: base.c:141
fr_assert(0)