fr_exit_now(1);
}
+ /*
+ * Set callbacks so that the socket is automatically
+ * paused or resumed when the socket becomes writeable.
+ */
+ client_config.pause_resume_cfg = (fr_bio_packet_cb_funcs_t) {
+ .write_blocked = client_bio_write_pause,
+ .write_resume = client_bio_write_resume,
+ };
+
/*
* Open the RADIUS client bio, and then get the information associated with it.
*/
fr_exit_now(1);
}
- /*
- * Set callbacks so that the socket is automatically
- * paused or resumed when the socket becomes writeable.
- */
- (void) fr_radius_client_bio_cb_set(client_bio, &(fr_bio_packet_cb_funcs_t) {
- .write_blocked = client_bio_write_pause,
- .write_resume = client_bio_write_resume,
- });
-
client_info = fr_radius_client_bio_info(client_bio);
fr_assert(client_info != NULL);
*/
my->fd->uctx = my;
+ /*
+ * Set up read / write blocked / resume callbacks.
+ */
+ if (cfg->pause_resume_cfg.write_blocked || cfg->pause_resume_cfg.read_blocked) {
+ fr_radius_client_bio_cb_set((fr_bio_packet_t *) my, &cfg->pause_resume_cfg);
+ }
+
my->info.fd_info = fr_bio_fd_info(my->fd);
fr_assert(my->info.fd_info != NULL);
fr_radius_client_fd_bio_t *my = talloc_get_type_abort(bio, fr_radius_client_fd_bio_t);
fr_bio_cb_funcs_t bio_cb = {};
+ /*
+ * If we have a "blocked" function, we must have a "resume" function, and vice versa.
+ */
+ fr_assert((cb->write_blocked != NULL) == (cb->write_resume != NULL));
+ fr_assert((cb->read_blocked != NULL) == (cb->read_resume != NULL));
+
#undef SET
#define SET(_x) if (cb->_x) bio_cb._x = fr_bio_ ## _x
fr_bio_retry_config_t retry_cfg;
+ fr_bio_packet_cb_funcs_t pause_resume_cfg;
+
bool outgoing[FR_RADIUS_CODE_MAX]; //!< allowed outgoing packet types
fr_retry_config_t retry[FR_RADIUS_CODE_MAX]; //!< default retry configuration for each packet type