diff options
author | Daniel Wagner <daniel.wagner@bmw-carit.de> | 2013-05-31 09:13:26 +0200 |
---|---|---|
committer | Patrik Flykt <patrik.flykt@linux.intel.com> | 2013-05-31 14:35:44 +0300 |
commit | e329cc8a43726a8e45b8f97d20f90d8782b40d0f (patch) | |
tree | f5c0ad93dd391080aaa97e4119677078373c1851 /src | |
parent | 32a8cf5a3ec6731b6adaa6fd061d08124427db5e (diff) | |
download | connman-e329cc8a43726a8e45b8f97d20f90d8782b40d0f.tar.gz connman-e329cc8a43726a8e45b8f97d20f90d8782b40d0f.tar.bz2 connman-e329cc8a43726a8e45b8f97d20f90d8782b40d0f.zip |
session: Add session argument to create_service_entry_cb
Remember which session this struct service_entry belongs to when
removing the entries again.
Diffstat (limited to 'src')
-rw-r--r-- | src/connman.h | 1 | ||||
-rw-r--r-- | src/service.c | 4 | ||||
-rw-r--r-- | src/session.c | 8 |
3 files changed, 9 insertions, 4 deletions
diff --git a/src/connman.h b/src/connman.h index 1e6bfec9..f4de8877 100644 --- a/src/connman.h +++ b/src/connman.h @@ -714,6 +714,7 @@ struct service_entry; typedef connman_bool_t (* service_match_cb) (struct connman_session *session, struct connman_service *service); typedef struct service_entry* (* create_service_entry_cb) ( + struct connman_session *session, struct connman_service *service, const char *name, enum connman_service_state state); diff --git a/src/service.c b/src/service.c index af8bfcee..3d03b2c7 100644 --- a/src/service.c +++ b/src/service.c @@ -2145,8 +2145,8 @@ GSequence *__connman_service_get_list(struct connman_session *session, service = g_sequence_get(iter); if (service_match(session, service) == TRUE) { - entry = create_service_entry(service, service->name, - service->state); + entry = create_service_entry(session, service, + service->name, service->state); if (entry == NULL) return list; diff --git a/src/session.c b/src/session.c index e5d8d856..0ac73c76 100644 --- a/src/session.c +++ b/src/session.c @@ -60,6 +60,7 @@ enum connman_session_state { }; struct service_entry { + struct connman_session *session; /* track why this service was selected */ enum connman_session_reason reason; enum connman_service_state state; @@ -1206,7 +1207,8 @@ static void select_and_connect(struct connman_session *session, } } -static struct service_entry *create_service_entry(struct connman_service *service, +static struct service_entry *create_service_entry(struct connman_session * session, + struct connman_service *service, const char *name, enum connman_service_state state) { @@ -1234,6 +1236,8 @@ static struct service_entry *create_service_entry(struct connman_service *servic type = connman_service_get_type(entry->service); entry->bearer = service2bearer(type); + entry->session = session; + return entry; } @@ -1939,7 +1943,7 @@ static void service_add(struct connman_service *service, if (service_match(session, service) == FALSE) continue; - entry = create_service_entry(service, name, + entry = create_service_entry(session, service, name, CONNMAN_SERVICE_STATE_IDLE); if (entry == NULL) continue; |