Fixed return value of controller_t functions if callback returns FALSE.

This commit is contained in:
Tobias Brunner
2012-05-02 14:45:38 +02:00
parent 052e0a17b8
commit ecb5abd7fa
2 changed files with 11 additions and 10 deletions
+1
View File
@@ -182,6 +182,7 @@ METHOD(listener_t, listener_log, bool,
{ {
if (!this->callback(this->param, group, level, ike_sa, format, args)) if (!this->callback(this->param, group, level, ike_sa, format, args))
{ {
this->status = NEED_MORE;
return listener_done(this); return listener_done(this);
} }
} }
+10 -10
View File
@@ -34,8 +34,8 @@
* @param args list of arguments to use for format * @param args list of arguments to use for format
* @return FALSE to return from invoked function * @return FALSE to return from invoked function
*/ */
typedef bool(*controller_cb_t)(void* param, debug_t group, level_t level, typedef bool (*controller_cb_t)(void* param, debug_t group, level_t level,
ike_sa_t* ike_sa, char* format, va_list args); ike_sa_t* ike_sa, char* format, va_list args);
/** /**
* Empty callback function for controller_t functions. * Empty callback function for controller_t functions.
@@ -75,9 +75,8 @@ struct controller_t {
/** /**
* Initiate a CHILD_SA, and if required, an IKE_SA. * Initiate a CHILD_SA, and if required, an IKE_SA.
* *
* The initiate() function is synchronous and thus blocks until the * If a callback is provided the function is synchronous and thus blocks
* IKE_SA is established or failed. Because of this, the initiate() function * until the IKE_SA is established or failed.
* contains a thread cancellation point.
* *
* @param peer_cfg peer_cfg to use for IKE_SA setup * @param peer_cfg peer_cfg to use for IKE_SA setup
* @param child_cfg child_cfg to set up CHILD_SA from * @param child_cfg child_cfg to set up CHILD_SA from
@@ -97,9 +96,8 @@ struct controller_t {
/** /**
* Terminate an IKE_SA and all of its CHILD_SAs. * Terminate an IKE_SA and all of its CHILD_SAs.
* *
* The terminate() function is synchronous and thus blocks until the * If a callback is provided the function is synchronous and thus blocks
* IKE_SA is properly deleted, or the delete timed out. * until the IKE_SA is properly deleted, or the call timed out.
* The terminate() function contains a thread cancellation point.
* *
* @param unique_id unique id of the IKE_SA to terminate. * @param unique_id unique id of the IKE_SA to terminate.
* @param cb logging callback * @param cb logging callback
@@ -118,6 +116,9 @@ struct controller_t {
/** /**
* Terminate a CHILD_SA. * Terminate a CHILD_SA.
* *
* If a callback is provided the function is synchronous and thus blocks
* until the CHILD_SA is properly deleted, or the call timed out.
*
* @param reqid reqid of the CHILD_SA to terminate * @param reqid reqid of the CHILD_SA to terminate
* @param cb logging callback * @param cb logging callback
* @param param parameter to include in each call of cb * @param param parameter to include in each call of cb
@@ -138,12 +139,11 @@ struct controller_t {
void (*destroy) (controller_t *this); void (*destroy) (controller_t *this);
}; };
/** /**
* Creates a controller instance. * Creates a controller instance.
* *
* @return controller_t object * @return controller_t object
*/ */
controller_t *controller_create(void); controller_t *controller_create();
#endif /** CONTROLLER_H_ @}*/ #endif /** CONTROLLER_H_ @}*/