network: Update network_connected implementation

This commit is contained in:
Denis Kenzior 2016-02-09 17:08:43 -06:00
parent b9402af687
commit 976bb7ceb1
1 changed files with 8 additions and 7 deletions

View File

@ -109,6 +109,7 @@ bool network_connected(uint32_t type, const char *ssid)
int err;
struct network_info *info;
struct network_info search;
const char *strtype;
search.type = type;
strncpy(search.ssid, ssid, 32);
@ -118,15 +119,15 @@ bool network_connected(uint32_t type, const char *ssid)
if (!info)
return false;
switch(type) {
case SCAN_SSID_SECURITY_PSK:
err = storage_network_get_mtime("psk", ssid,
&info->connected_time);
break;
default:
strtype = scan_ssid_security_to_str(type);
if (!strtype)
goto fail;
}
err = storage_network_touch(strtype, ssid);
if (err < 0)
goto fail;
err = storage_network_get_mtime(strtype, ssid, &info->connected_time);
if (err < 0)
goto fail;