Fix bug(N_SE-22984)
authorKim Gibyoung <lastkgb.kim@samsung.com>
Fri, 25 Jan 2013 07:39:31 +0000 (16:39 +0900)
committerKim Gibyoung <lastkgb.kim@samsung.com>
Fri, 25 Jan 2013 08:42:25 +0000 (17:42 +0900)
Change-Id: I302de32ba687812a771fe5ec28315edcdf5f60f0

debian/changelog
packaging/wifi-direct-manager.spec
plugin/wpasupplicant/src/wifi-direct-plugin.c
src/wifi-direct-client-handler.c
src/wifi-direct-dhcp.c
src/wifi-direct-event-handler.c
src/wifi-direct-main.c

index 08157f1..b4156bd 100644 (file)
@@ -1,3 +1,11 @@
+wfi-direct-manager (0.5.8) precise; urgency=low
+
+  * Fix bug(N_SE-22984)
+  * Git : framework/connectivity/wifi-direct-manager
+  * Tag : wifi-direct-manager_0.5.8
+
+ -- Gibyoung Kim <lastkgb.kim@samsung.com>  Fri, 25 Jan 2013 16:37:42 +0900
+
 wfi-direct-manager (0.5.7) precise; urgency=low
 
   * Fix bug(N_SE-21973)
index b31e914..64302b8 100755 (executable)
@@ -1,6 +1,6 @@
 Name:       wifi-direct-manager
 Summary:    Wi-Fi Direct manger
-Version:    0.5.7
+Version:    0.5.8
 Release:    1
 Group:      TO_BE_FILLED
 License:    Samsung Proprietary License
@@ -14,7 +14,6 @@ BuildRequires:  pkgconfig(capi-appfw-application)
 BuildRequires:  cmake
 
 
-#%define debug_package %{nil}  
 
 %description
 Wi-Fi Direct manager
index d05ee09..5d2b4ed 100644 (file)
@@ -1118,10 +1118,7 @@ void __parsing_ws_event(char* buf, ws_event_s *event)
                case WS_EVENT_GO_NEG_REQUEST:
                        {
                                WDP_LOGD( "WS EVENT : [WS_EVENT_GO_NEG_REQUEST]");
-                               // TODO: check validity of event
-                               int wpa_mode;
 
-                               wfd_server_control_t *wfd_server = wfd_server_get_control();
                                event->id = WS_EVENT_GO_NEG_REQUEST;
                                ptr = __get_event_str(ptr + 19, event_str);
                                strncpy(event->peer_intf_mac_address, event_str, sizeof(event->peer_intf_mac_address));
@@ -2255,7 +2252,6 @@ int wfd_ws_wps_pin_start(unsigned char peer_addr[6])
 
        char cmd[50] = {0, };
        char mac_str[18] = {0, };
-       char wps_str[8] = {0, };
        char res_buffer[1024]={0,};
        int res_buffer_len = sizeof(res_buffer);
        int result;
@@ -2290,7 +2286,6 @@ int wfd_ws_connect(unsigned char mac_addr[6], wifi_direct_wps_type_e wps_config)
 
        char cmd[64] = {0, };
        char mac_str[18] = {0, };
-       char wps_str[8] = {0, };
        char res_buffer[1024]={0,};
        int res_buffer_len = sizeof(res_buffer);
        int result;
@@ -3640,7 +3635,8 @@ int wfd_ws_get_connected_peers_info(wfd_connected_peer_info_s ** peer_list, int*
                /*
                        typedef struct
                        {
-                               char ssid[WIFI_DIRECT_MAX_SSID_LEN + 1];
+                               char device_name[WIFI_DIRECT_MAX_DEVICE_NAME_LEN + 1];
+                               unsigned char ip_address[4];
                                unsigned char mac_address[6];
                                unsigned char intf_mac_address[6];
                                unsigned int services;
@@ -3649,9 +3645,9 @@ int wfd_ws_get_connected_peers_info(wfd_connected_peer_info_s ** peer_list, int*
                                int channel;
                        } wfd_connected_peer_info_s;
                 */
+
                result = __extract_value_str(res_buffer, "device_name", (char*) tmp_peer_list[i].device_name);
-               if(result <= 0)
-               {
+               if(result <= 0) {
                        WDP_LOGE( "Extracting value failed\n");
                        *peer_list = NULL;
                        *peer_num = 0;
index 28bc167..ba68cf5 100644 (file)
@@ -312,11 +312,11 @@ int wfd_server_find_peer_by_macaddr(wfd_discovery_entry_s *plist, int entry_size
 }
 
 
-int wfd_server_send_response(int sockfd, void * data, int len)
+int wfd_server_send_response(int sockfd, void *data, int len)
 {
        int ret_val = 0;
-       wfd_server_control_t * wfd_server = wfd_server_get_control();
-       wifi_direct_client_response_s*  resp = (wifi_direct_client_response_s*) data;
+       wfd_server_control_t *wfd_server = wfd_server_get_control();
+       wifi_direct_client_response_s *resp = (wifi_direct_client_response_s*) data;
 
        __WDS_LOG_FUNC_ENTER__;
 
@@ -401,7 +401,7 @@ void wfd_server_process_client_request(wifi_direct_client_request_s * client_req
                        wfd_server_send_response(client->sync_sockfd, &resp, sizeof(wifi_direct_client_response_s));
 
                        int res = 0;
-                       wifi_direct_client_noti_s               noti;
+                       wifi_direct_client_noti_s noti;
                        memset(&noti, 0, sizeof(wifi_direct_client_noti_s));
 
                        noti.event = WIFI_DIRECT_CLI_EVENT_ACTIVATION;
@@ -410,14 +410,13 @@ void wfd_server_process_client_request(wifi_direct_client_request_s * client_req
                        // Initialize server db.
                        {
                                int i = -1;
-                               unsigned char NULL_MAC[6] = {0,0,0,0,0,0};
                                for(i=0;i<WFD_MAX_ASSOC_STA;i++)
                                {
                                        memset(&wfd_server->connected_peers[i], 0, sizeof(wfd_local_connected_peer_info_t));
                                        wfd_server->connected_peers[i].isUsed = 0;
                                }
                                wfd_server->connected_peer_count = 0;
-                               memcpy(wfd_server->current_peer.mac_address, NULL_MAC, 6);
+                               memset(&wfd_server->current_peer, 0x00, sizeof(wfd_discovery_entry_s));
                        }
 
                        wfd_server_set_state(WIFI_DIRECT_STATE_ACTIVATING);
@@ -974,7 +973,7 @@ void wfd_server_process_client_request(wifi_direct_client_request_s * client_req
                }
                else
                {
-                       sprintf(resp.param2, ssid);
+                       snprintf(resp.param2, sizeof(resp.param2), "%s", ssid);
                        resp.result = WIFI_DIRECT_ERROR_NONE;
                }
 
@@ -992,7 +991,7 @@ void wfd_server_process_client_request(wifi_direct_client_request_s * client_req
                char device_name[WIFI_DIRECT_MAX_DEVICE_NAME_LEN+1];
 
                strncpy(device_name, wfd_server->config_data.device_name, WIFI_DIRECT_MAX_DEVICE_NAME_LEN);
-               sprintf(resp.param2, device_name);
+               snprintf(resp.param2, sizeof(resp.param2), "%s", device_name);
                resp.result = WIFI_DIRECT_ERROR_NONE;
 
                if (wfd_server_send_response(client->sync_sockfd, &resp, sizeof(wifi_direct_client_response_s)) < 0)
@@ -1040,7 +1039,7 @@ void wfd_server_process_client_request(wifi_direct_client_request_s * client_req
        case WIFI_DIRECT_CMD_GET_IP_ADDR:
        {
                char* ip_addr = wfd_oem_get_ip();
-               sprintf(resp.param2, ip_addr);
+               snprintf(resp.param2, sizeof(resp.param2), "%s", ip_addr);
 
                resp.result = WIFI_DIRECT_ERROR_NONE;
                if (wfd_server_send_response(client->sync_sockfd, &resp, sizeof(wifi_direct_client_response_s)) < 0)
@@ -1098,7 +1097,7 @@ void wfd_server_process_client_request(wifi_direct_client_request_s * client_req
                else
                {
                        WDS_LOGD( "pin [%s]\n", pin);
-                       sprintf(resp.param2, pin);
+                       snprintf(resp.param2, sizeof(resp.param2), "%s", pin);
                        resp.result = WIFI_DIRECT_ERROR_NONE;
                }
                if (wfd_server_send_response(client->sync_sockfd, &resp, sizeof(wifi_direct_client_response_s)) < 0)
@@ -1237,88 +1236,73 @@ void wfd_server_process_client_request(wifi_direct_client_request_s * client_req
        {
                int total_msg_len = 0;
                wfd_connected_peer_info_s* plist = NULL;
-               wfd_connected_peer_info_s plist_buf;
-               wfd_connected_peer_info_s* tmp_plist = NULL;            
-               wfd_local_connected_peer_info_t* tmplist = NULL;                
                int peer_count = 0;
-               int i;
-               int val = 0;
+               int i = 0, j = 0;
 
                wifi_direct_state_e state = wfd_server_get_state();
                ret = WIFI_DIRECT_ERROR_NONE;
-               if (state == WIFI_DIRECT_STATE_CONNECTED)
-               {
-                       val = wfd_oem_get_connected_peers_info(&tmp_plist, &peer_count);
-                       if (val == false)
-                       {
-                               WDS_LOGE( "Error!! wfd_oem_get_connected_peers_info() failed..\n");
-                               peer_count = 0;
-                               tmp_plist = NULL;
-                               ret = WIFI_DIRECT_ERROR_OPERATION_FAILED;
+               if (state < WIFI_DIRECT_STATE_CONNECTED) {
+                       WDS_LOGE( "state != WIFI_DIRECT_STATE_CONNECTED\n");
+                       resp.result = WIFI_DIRECT_ERROR_NOT_PERMITTED;
+                       if (wfd_server_send_response(client->sync_sockfd, &resp,
+                                                                                       sizeof(wifi_direct_client_response_s)) < 0) {
+                               wfd_server_reset_client(client->sync_sockfd);
+                               __WDS_LOG_FUNC_EXIT__;
+                               return;
                        }
-                       else
-                       {
-                               tmplist = wfd_server_get_connected_peer_by_interface_mac(tmp_plist[0].intf_mac_address);
-                               if (tmplist == NULL)
-                               {
-                                       WDS_LOGE( "Error!! Can't find connected peer info of mac=[" MACSTR "]\n",
-                                                       MAC2STR(tmp_plist[0].intf_mac_address));
-                                       peer_count = 0;
-                                       ret = WIFI_DIRECT_ERROR_OPERATION_FAILED;
-                               }
-                               else
-                               {
-                                       memset(&plist_buf, 0, sizeof(plist_buf));
-                                       strncpy(plist_buf.device_name, tmplist->peer.device_name, sizeof(plist_buf.device_name));
-                                       memcpy(&plist_buf.intf_mac_address[0], &tmplist->int_address[0], 6);
-                                       memcpy(&plist_buf.mac_address[0], &tmplist->peer.mac_address[0], 6);
-                                       plist_buf.services = tmplist->peer.services;
-                                       plist_buf.is_p2p = 1;
-                                       plist_buf.category = tmplist->peer.category;
-                                       plist_buf.channel = wfd_oem_get_operating_channel();
-                                       memcpy(&plist_buf.ip_address[0], &tmplist->ip_address[0], 4);
-                                       
-                                       plist = &plist_buf;
-                                       peer_count = 1;
-                               }
+                       break;
+
+               }
+               WDS_LOGD("WFD status [%d]", state);
+
+               peer_count = wfd_server->connected_peer_count;
+               if (peer_count <= 0) {
+                       WDS_LOGE("Error?? There is no connected peers");
+                       resp.result = WIFI_DIRECT_ERROR_OPERATION_FAILED;
+                       if (wfd_server_send_response(client->sync_sockfd, &resp,
+                                                                                       sizeof(wifi_direct_client_response_s)) < 0) {
+                               wfd_server_reset_client(client->sync_sockfd);
+                               __WDS_LOG_FUNC_EXIT__;
+                               return;
                        }
+                       break;
                }
-               else if (state == WIFI_DIRECT_STATE_GROUP_OWNER)
+               WDS_LOGD("Connected peer count [%d]", peer_count);
+
+               plist = (wfd_connected_peer_info_s*) calloc(peer_count, sizeof(wfd_connected_peer_info_s));
+               if(plist == NULL)
                {
-                       val = wfd_oem_get_connected_peers_info(&plist, &peer_count);
-                       if (val == false)
-                       {
-                               WDS_LOGE( "Error!! wfd_oem_get_connected_peers_info() failed..\n");
-                               ret = WIFI_DIRECT_ERROR_OPERATION_FAILED;
-                       }
-                       else
-                       {
-                               // Append Device MAC address
-                               for(i=0;i<peer_count;i++)
-                               {
-                                       tmplist = wfd_server_get_connected_peer_by_interface_mac(plist[i].intf_mac_address);
-                                       if (tmplist != NULL)
-                                       {
-                                               memcpy(&plist[i].mac_address[0], &tmplist->peer.mac_address[0], 6);
-                                               memcpy(&plist[i].ip_address[0], &tmplist->ip_address[0], 4);
-                                       }
-                                       else
-                                       {
-                                               WDS_LOGE( "Error, Cant' find connected peer by int_addr" MACSTR "!!\n",
-                                                               MAC2STR(plist[i].intf_mac_address));
-                                               // continue...
-                                       }
-                               }
+                       WDS_LOGF( "Memory Allocation is FAILED!!!!!![%d]\n");
+                       resp.result = WIFI_DIRECT_ERROR_OPERATION_FAILED;
+                       if (wfd_server_send_response(client->sync_sockfd, &resp,
+                                                                                       sizeof(wifi_direct_client_response_s)) < 0) {
+                               wfd_server_reset_client(client->sync_sockfd);
+                               __WDS_LOG_FUNC_EXIT__;
+                               return;
                        }
+                       break;
                }
-               else
+
+               while(j < peer_count && i < WFD_MAX_ASSOC_STA)
                {
-                       plist = NULL;
-                       peer_count = 0;
-                       WDS_LOGE( "state != WIFI_DIRECT_STATE_CONNECTED\n");
-                       ret = WIFI_DIRECT_ERROR_NOT_PERMITTED;
-               }
+                       if (wfd_server->connected_peers[i].isUsed == 0) {
+                               WDS_LOGD("Not used peer info [%s]", wfd_server->connected_peers[i].peer.device_name);
+                               i++;
+                               continue;
+                       }
+                       WDS_LOGD("Connected peer info found [%s]", wfd_server->connected_peers[i].peer.device_name);
+
+                       strncpy(plist[j].device_name, wfd_server->connected_peers[i].peer.device_name, WIFI_DIRECT_MAX_DEVICE_NAME_LEN);
+                       memcpy(&plist[j].intf_mac_address[0], wfd_server->connected_peers[i].int_address, 6);
+                       memcpy(&plist[j].mac_address[0], wfd_server->connected_peers[i].peer.mac_address, 6);
+                       plist[j].services = wfd_server->connected_peers[i].peer.services;
+                       plist[j].is_p2p = 1;
+                       plist[j].category = wfd_server->connected_peers[i].peer.category;
+                       plist[j].channel = wfd_server->connected_peers[i].peer.channel;
+                       memcpy(&plist[j].ip_address[0], wfd_server->connected_peers[i].ip_address, 4);
 
+                       j++;
+               }
                total_msg_len = sizeof(wifi_direct_client_response_s) + (sizeof(wfd_connected_peer_info_s) * peer_count);
 
                WDS_LOGD( "Peer count : %d, total message size : %d\n", peer_count, total_msg_len);
@@ -1338,12 +1322,7 @@ void wfd_server_process_client_request(wifi_direct_client_request_s * client_req
                }
 
                resp.param1 = peer_count;
-#if 0
-               if (ret == TRUE)
-                       resp.result = WIFI_DIRECT_ERROR_NONE;
-#else
                resp.result = ret;
-#endif
 
                memset(msg, 0, total_msg_len);
                memcpy(msg, &resp, sizeof(wifi_direct_client_response_s));
index abe415b..b8fa5dc 100644 (file)
@@ -20,6 +20,7 @@
 #include <glib.h>
 #include <errno.h>
 #include <stdio.h>
+#include <stdlib.h>
 #include <string.h>
 #include <stdbool.h>
 #include <unistd.h>
@@ -341,24 +342,23 @@ void __wfd_DHCP_lease_add_cb(keynode_t *key, void* data)
                continue;
         }
         wfd_macaddr_atoe(mac_str, mac_hex);
-        __wfd_server_print_connected_peer();
         for(i=0; i<WFD_MAX_ASSOC_STA; i++)
         {
 
                if (wfd_server->connected_peers[i].isUsed == 1 &&
                                memcmp(mac_hex, wfd_server->connected_peers[i].int_address, 6) == 0)
                {
-                       WDS_LOGD( "Found peer: interface mac=[%s].\n",mac_str);
-                       WDS_LOGD( "device mac=["MACSTR"]\n",MAC2STR(wfd_server->connected_peers[i].peer.mac_address));
+                       WDS_LOGD( "Found peer: interface mac=[%s].\n",mac_str);
+                       WDS_LOGD( "device mac=["MACSTR"]\n",MAC2STR(wfd_server->connected_peers[i].peer.mac_address));
 
-                       inet_aton(ip_str, (struct in_addr*)&wfd_server->connected_peers[i].ip_address);
-                       WDS_LOGD( "Fill IP: ip=[%s].\n",ip_str);
+                       inet_aton(ip_str, (struct in_addr*)&wfd_server->connected_peers[i].ip_address);
+                       WDS_LOGD( "Fill IP: ip=[%s].\n",ip_str);
 
-                       //Send event to client with [dev_mac, ip]
-               noti.event = WIFI_DIRECT_CLI_EVENT_IP_LEASED_IND;
-               snprintf(noti.param1, 18, MACSTR, MAC2STR(wfd_server->connected_peers[i].peer.mac_address));
-               strncpy(noti.param2, ip_str, strlen(ip_str));
-               __wfd_server_send_client_event(&noti);
+                       //Send event to client with [dev_mac, ip]
+                       noti.event = WIFI_DIRECT_CLI_EVENT_IP_LEASED_IND;
+                       snprintf(noti.param1, 18, MACSTR, MAC2STR(wfd_server->connected_peers[i].peer.mac_address));
+                       strncpy(noti.param2, ip_str, strlen(ip_str));
+                       __wfd_server_send_client_event(&noti);
                        break;
                }
         }
index 5476cb6..4f3f2a4 100644 (file)
 \r
 #include <errno.h>\r
 #include <stdio.h>\r
+#include <stdlib.h>\r
 #include <string.h>\r
 #include <stdbool.h>\r
 #include <sys/types.h>\r
+#include <sys/socket.h>\r
 #include <unistd.h>\r
 \r
+#include <glib.h>\r
+\r
 #include "wifi-direct-service.h"\r
 #include "wifi-direct-event-handler.h"\r
 #include "wifi-direct-oem.h"\r
@@ -252,7 +256,7 @@ void wfd_server_start_dhcp_wait_timer()
 \r
 #endif\r
 \r
-       wfd_server->dhcp_ip_address_timer = g_timeout_add(1000, __wfd_get_ip_address, NULL);\r
+       wfd_server->dhcp_ip_address_timer = g_timeout_add(1000, (GSourceFunc) __wfd_get_ip_address, NULL);\r
 }\r
 \r
 void wfd_server_cancel_dhcp_wait_timer()\r
@@ -406,7 +410,6 @@ void wfd_server_remove_connected_peer(wfd_discovery_entry_s * peer)
 \r
        wfd_server_control_t *wfd_server = wfd_server_get_control();\r
        int i;\r
-       unsigned char NULL_IP[4] = { 0, 0, 0, 0};\r
 \r
        for (i = 0; i < WFD_MAX_ASSOC_STA; i++)\r
        {\r
@@ -415,7 +418,7 @@ void wfd_server_remove_connected_peer(wfd_discovery_entry_s * peer)
                {\r
                        wfd_server->connected_peers[i].isUsed = 0;\r
                        wfd_server->connected_peer_count--;\r
-                       memcpy(wfd_server->connected_peers[i].ip_address, NULL_IP, 4);\r
+                       memset(&wfd_server->connected_peers[i], 0x00, sizeof(wfd_local_connected_peer_info_t));\r
                        break;\r
                }\r
        }\r
@@ -428,7 +431,6 @@ void wfd_server_remove_connected_peer_by_interface_mac(unsigned char interface_m
 \r
        wfd_server_control_t *wfd_server = wfd_server_get_control();\r
        int i;\r
-       unsigned char NULL_IP[4] = { 0, 0, 0, 0};\r
 \r
        for (i = 0; i < WFD_MAX_ASSOC_STA; i++)\r
        {\r
@@ -437,7 +439,7 @@ void wfd_server_remove_connected_peer_by_interface_mac(unsigned char interface_m
                {\r
                        wfd_server->connected_peers[i].isUsed = 0;\r
                        wfd_server->connected_peer_count--;\r
-                       memcpy(wfd_server->connected_peers[i].ip_address, NULL_IP, 4);\r
+                       memset(&wfd_server->connected_peers[i], 0x00, sizeof(wfd_local_connected_peer_info_t));\r
                        break;\r
                }\r
        }\r
@@ -890,18 +892,16 @@ void wfd_server_process_event(wfd_event_t event)
                                                wfd_server_get_connected_peer_by_interface_mac(interface_mac);\r
                                        if (peer != NULL)\r
                                        {\r
-                                               WDS_LOGI(\r
-                                                                          "Peer's Intf MAC: " MACSTR ", Device MAC:" MACSTR " \n",\r
-                                                                          MAC2STR(interface_mac),\r
-                                                                          MAC2STR(peer->peer.mac_address));\r
+                                               WDS_LOGI("Peer's Intf MAC: " MACSTR ", Device MAC:" MACSTR " \n",\r
+                                                                       MAC2STR(interface_mac),\r
+                                                                       MAC2STR(peer->peer.mac_address));\r
                                                snprintf(noti.param1, sizeof(noti.param1), MACSTR,\r
                                                                 MAC2STR(peer->peer.mac_address));\r
                                        }\r
                                        else\r
                                        {\r
-                                               WDS_LOGI(\r
-                                                                          "Peer's Intf MAC: " MACSTR ", Device MAC:null \n",\r
-                                                                          MAC2STR(interface_mac));\r
+                                               WDS_LOGI("Peer's Intf MAC: " MACSTR ", Device MAC:null \n",\r
+                                                                       MAC2STR(interface_mac));\r
                                                memset(noti.param1, 0, 6);\r
                                        }\r
 \r
@@ -914,25 +914,20 @@ void wfd_server_process_event(wfd_event_t event)
                                                wfd_server->config_data.wps_config =\r
                                                        WIFI_DIRECT_WPS_TYPE_PBC;\r
                                                if (wfd_oem_disconnect() == false)\r
-                                               {\r
-                                                       WDS_LOGF(\r
-                                                                                  "Error!!! wfd_oem_disconnect() failed!!..\n");\r
-                                               }\r
+                                                       WDS_LOGF("Error!!! wfd_oem_disconnect() failed!!..\n");\r
                                        }\r
                                        noti.event = WIFI_DIRECT_CLI_EVENT_DISASSOCIATION_IND;\r
                                        __wfd_server_send_client_event(&noti);\r
                                }\r
                                else\r
                                {\r
-                                       WDS_LOGF(\r
-                                                                  "Error!!! DISASSOC event come..\n");\r
+                                       WDS_LOGF("Error!!! DISASSOC event come..\n");\r
                                }\r
                        }\r
                        break;\r
 \r
                case WFD_EVENT_PRIMARY_IF_DISCONNECTION:\r
-                       WDS_LOGD(\r
-                                                  "Primary interface (wlan0) is down. Just let it up!\n");\r
+                       WDS_LOGD("Primary interface (wlan0) is down. Just let it up!\n");\r
                        system("ifconfig wlan0 up");\r
                        break;\r
 \r
@@ -944,29 +939,26 @@ void wfd_server_process_event(wfd_event_t event)
                                                                   "Peer's Dev MAC is " MACSTR "\n",\r
                                                                   MAC2STR(wfd_server->current_peer.\r
                                                                                   mac_address));\r
-                                       //WDS_LOGI( "Peer's SSID is [%s]\n", wfd_server->current_peer.ssid);\r
                                        snprintf(noti.param1, sizeof(noti.param1), MACSTR,\r
                                                         MAC2STR(wfd_server->current_peer.mac_address));\r
-                                       //strncpy(noti.param2, wfd_server->current_peer.ssid, strlen(wfd_server->current_peer.ssid));\r
 \r
-                                       wfd_server_clear_connected_peer();\r
-                                       wfd_server->config_data.wps_config =\r
-                                               WIFI_DIRECT_WPS_TYPE_PBC;\r
+                                       wfd_server->config_data.wps_config = WIFI_DIRECT_WPS_TYPE_PBC;\r
                                        noti.event = WIFI_DIRECT_CLI_EVENT_DISCONNECTION_IND;\r
                                        __wfd_server_send_client_event(&noti);\r
                                        wfd_server_set_state(WIFI_DIRECT_STATE_ACTIVATED);\r
                                }\r
                                else\r
                                {\r
-                                       WDS_LOGD(\r
-                                                                  "message is ignored [%d] at state=[%d]\n",\r
-                                                                  event, state);\r
+                                       WDS_LOGD("message is ignored [%d] at state=[%d]\n",\r
+                                                               event, state);\r
                                }\r
+                               wfd_server_clear_connected_peer();\r
+\r
                        }\r
                        break;\r
                case WFD_EVENT_CREATE_LINK_DOWN:\r
                        {\r
-                               if (state == WIFI_DIRECT_STATE_CONNECTED)\r
+                               if (state >= WIFI_DIRECT_STATE_CONNECTED)\r
                                {\r
                                        WDS_LOGI(\r
                                                                   "Peer's Intf MAC: " MACSTR ", Device MAC:" MACSTR " \n",\r
@@ -977,8 +969,7 @@ void wfd_server_process_event(wfd_event_t event)
                                                         MAC2STR(wfd_server->connected_peers[0].peer.mac_address));\r
 \r
                                        wfd_server_clear_connected_peer();\r
-                                       wfd_server->config_data.wps_config =\r
-                                               WIFI_DIRECT_WPS_TYPE_PBC;\r
+                                       wfd_server->config_data.wps_config = WIFI_DIRECT_WPS_TYPE_PBC;\r
                                        noti.event = WIFI_DIRECT_CLI_EVENT_DISCONNECTION_IND;\r
                                        __wfd_server_send_client_event(&noti);\r
                                        wfd_server_set_state(WIFI_DIRECT_STATE_ACTIVATED);\r
index d171011..3e7b421 100644 (file)
@@ -321,7 +321,6 @@ void wfd_load_plugin()
 static int wfd_server_init(void)
 {
        __WDS_LOG_FUNC_ENTER__;
-       int i = -1;
 
        memset(&g_wfd_server, 0x00, sizeof(wfd_server_control_t));
        g_wfd_server.async_sockfd = -1;
@@ -542,7 +541,6 @@ static gboolean wfd_discovery_timeout_cb(void *user_data)
 {
        __WDS_LOG_FUNC_ENTER__;
        wfd_server_control_t *wfd_server = wfd_server_get_control();
-       wifi_direct_client_noti_s noti;
        int ret;
 
        g_source_remove(wfd_server->discovery_timer);
@@ -563,15 +561,6 @@ static gboolean wfd_discovery_timeout_cb(void *user_data)
                WDS_LOGE( "Error!! wfd_oem_cancel_discovery() failed..\n");
        }
 
-#if 0
-       memset(&noti, 0, sizeof(wifi_direct_client_noti_s));
-
-       noti.event = WIFI_DIRECT_CLI_EVENT_DISCOVER_END;
-       noti.error = WIFI_DIRECT_ERROR_NONE;
-
-       __wfd_server_send_client_event(&noti);
-#endif
-
        __WDS_LOG_FUNC_EXIT__;
        return FALSE;
 }