From: Seungyoun Ju Date: Tue, 27 Nov 2012 10:05:52 +0000 (+0900) Subject: Duplicated station information issue is fixed X-Git-Tag: 2.1b_release~1^2~19 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7b168e8b5366e831006307c65d11a6dc717b7195;p=framework%2Fconnectivity%2Fmobileap-agent.git Duplicated station information issue is fixed - Issues When DHCP ACK is came repeatedly, duplicated station notification is sent to application. - Fix description If it is already connected device's DHCP ACK, it is ignored. Change-Id: I9692c09ed096238c2ac991461d0ffd0259658c97 --- diff --git a/include/mobileap_agent.h b/include/mobileap_agent.h index 76513a9..841ef85 100644 --- a/include/mobileap_agent.h +++ b/include/mobileap_agent.h @@ -207,8 +207,8 @@ gboolean _deinit_tethering(MobileAPObject *obj); gboolean _mobileap_clear_state(int state); -int _mobileap_is_disabled(void); -int _mobileap_is_enabled(int state); +gboolean _mobileap_is_disabled(void); +gboolean _mobileap_is_enabled(mobile_ap_type_e type); gboolean _mobileap_set_state(int state); #endif diff --git a/src/mobileap_common.c b/src/mobileap_common.c index af57fb8..084f965 100644 --- a/src/mobileap_common.c +++ b/src/mobileap_common.c @@ -162,6 +162,12 @@ int _add_station_info(mobile_ap_station_info_t *info) mobile_ap_station_info_t *si = NULL; int i = 0; + if (_get_station_info(info->mac, _slist_find_station_by_mac, &si) == + MOBILE_AP_ERROR_NONE) { + DBG("Already exist station : %s\n", info->mac); + return MOBILE_AP_ERROR_INTERNAL; + } + station_list = g_slist_append(station_list, info); for (l = station_list; l != NULL; l = g_slist_next(l)) { si = (mobile_ap_station_info_t *)l->data; diff --git a/src/mobileap_main.c b/src/mobileap_main.c index c35181a..36c8e3c 100644 --- a/src/mobileap_main.c +++ b/src/mobileap_main.c @@ -151,14 +151,14 @@ gboolean _mobileap_set_state(int state) return TRUE; } -int _mobileap_is_disabled(void) +gboolean _mobileap_is_disabled(void) { - return !mobileap_state; + return mobileap_state ? FALSE : TRUE; } -int _mobileap_is_enabled(int state) +gboolean _mobileap_is_enabled(mobile_ap_type_e type) { - return (mobileap_state & state) ? 1 : 0; + return (mobileap_state & type) ? TRUE : FALSE; } gboolean _mobileap_clear_state(int state) @@ -447,12 +447,16 @@ static DBusHandlerResult __dnsmasq_signal_filter(DBusConnection *conn, dbus_error_free(&error); return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; } - DBG("DhcpConnected signal : %s %s %s\n", ip_addr, mac, name); if (_get_tethering_type_from_ip(ip_addr, &type) != MOBILE_AP_ERROR_NONE) return DBUS_HANDLER_RESULT_HANDLED; + if (_mobileap_is_enabled(type) != FALSE) { + DBG("Tethering[%d] is disabled. Ignore ACK\n", type); + return DBUS_HANDLER_RESULT_HANDLED; + } + info = (mobile_ap_station_info_t *)malloc(sizeof(mobile_ap_station_info_t)); if (info == NULL) { ERR("malloc failed\n"); @@ -483,7 +487,11 @@ static DBusHandlerResult __dnsmasq_signal_filter(DBusConnection *conn, } } - _add_station_info(info); + if (_add_station_info(info) != MOBILE_AP_ERROR_NONE) { + free(info); + return DBUS_HANDLER_RESULT_HANDLED; + } + _send_dbus_station_info("DhcpConnected", info); return DBUS_HANDLER_RESULT_HANDLED;