From: Mika Liljeberg Date: Mon, 29 Nov 2010 09:36:11 +0000 (+0200) Subject: gisi: modify reachability check X-Git-Tag: 0.37~61 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3652340b1bcf802b0d45c1499494dfd8fc2e7b34;p=platform%2Fupstream%2Fofono.git gisi: modify reachability check Always cache server object ID and ISI version. --- diff --git a/gisi/modem.c b/gisi/modem.c index 7476bef..84486f4 100644 --- a/gisi/modem.c +++ b/gisi/modem.c @@ -45,6 +45,7 @@ struct _GIsiServiceMux { GIsiVersion version; uint8_t resource; uint8_t last_utid; + uint16_t object; unsigned subscriptions; unsigned registrations; gboolean reachable; @@ -194,6 +195,11 @@ static void common_message_decode(GIsiServiceMux *mux, GIsiMessage *msg) return; switch (code) { + case COMM_ISA_ENTITY_NOT_REACHABLE_RESP: + mux->reachable = FALSE; + msg->error = ENOENT; + break; + case COMM_ISI_VERSION_GET_RESP: if (g_isi_msg_data_get_byte(msg, 1, &major) && @@ -201,13 +207,7 @@ static void common_message_decode(GIsiServiceMux *mux, GIsiMessage *msg) mux->version.major = major; mux->version.minor = minor; } - mux->version_pending = FALSE; - break; - - case COMM_ISA_ENTITY_NOT_REACHABLE_RESP: - mux->reachable = FALSE; - msg->error = ENOENT; - break; + /* fall through */ case 0x00: /* @@ -215,7 +215,9 @@ static void common_message_decode(GIsiServiceMux *mux, GIsiMessage *msg) * 0x00 message as a response. Work around this modem * wart. */ + mux->object = g_isi_msg_object(msg); mux->version_pending = FALSE; + mux->reachable = TRUE; break; } msg->version = &mux->version; @@ -262,12 +264,6 @@ static gboolean isi_callback(GIOChannel *channel, GIOCondition cond, if (!mux) return TRUE; - /* - * For now, assume any message received means that the - * resource is reachable - */ - mux->reachable = TRUE; - if (g_isi_msg_id(&msg) == COMMON_MESSAGE) common_message_decode(mux, &msg); @@ -953,6 +949,8 @@ static gboolean reachable_notify(gpointer data) struct sockaddr_pn addr = { .spn_resource = mux->resource, + .spn_dev = mux->object >> 8, + .spn_obj = mux->object & 0xff, }; GIsiMessage msg = { .version = &mux->version,