Hi Patrik
On 05.11.2012 14:23, Patrik Flykt wrote:
Hi,
On Fri, 2012-11-02 at 17:26 +0100, Daniel Wagner wrote:
From: Daniel Wagner <[email protected]>
Give a policy plugin a way to inform the session core that
some of the config values have changed.
This could be done in a more clever way, e.g. figure out only
to update the necessary info entries but we keep it for now
as simple and assume everthing has changed.
---
include/session.h | 2 ++
src/session.c | 38 ++++++++++++++++++++++++++++++++++++++
2 files changed, 40 insertions(+)
diff --git a/include/session.h b/include/session.h
index b93fbc7..cbed939 100644
--- a/include/session.h
+++ b/include/session.h
@@ -75,6 +75,8 @@ struct connman_session_policy {
int connman_session_policy_register(struct connman_session_policy *config);
void connman_session_policy_unregister(struct connman_session_policy *config);
+void connman_session_config_update(struct connman_session *session);
+
struct connman_session_config *connman_session_create_default_config(void);
#ifdef __cplusplus
diff --git a/src/session.c b/src/session.c
index 77a6c85..ff12a35 100644
--- a/src/session.c
+++ b/src/session.c
@@ -1341,6 +1341,44 @@ static void session_changed(struct connman_session
*session,
session_notify(session);
}
+void connman_session_config_update(struct connman_session *session)
+{
+ struct session_info *info = session->info;
+ GSList *allowed_bearers;
+ int err;
+
+ DBG("session %p", session);
+
+ /*
+ * We update all configuration even though only one entry
+ * might have changed. We can still optimize this later.
+ */
+
+ err = apply_policy_on_bearers(
+ session->policy_config->allowed_bearers,
+ info->config.allowed_bearers,
+ &allowed_bearers);
+ if (err < 0)
+ return;
If there really is an error applying policy on bearers, shouldn't we
ensure that the session is disconnected or something?
With the current code there never are any errors, since only
filter_bearer() errors are returned but filter_bearer() always returns
0.
I was not sure how to handle the error case here. Yep your idea makes sens.
Another thing we should also do here is to return an error code. So that
plugin knows something went wrong.
cheers,
daniel
_______________________________________________
connman mailing list
[email protected]
http://lists.connman.net/listinfo/connman