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