wpa_gui-qt4: Stop BSS fetch loop on error for Peers dialog

There is no need to continue the loop until the 1000 max BSS limit
if a BSS command fails.
This commit is contained in:
Jouni Malinen 2010-01-24 18:42:45 -08:00
parent 48563d86b2
commit c5674000a3
2 changed files with 8 additions and 5 deletions

View file

@ -334,19 +334,19 @@ void Peers::remove_bss(int id)
}
void Peers::add_bss(const char *cmd)
bool Peers::add_bss(const char *cmd)
{
char reply[2048];
size_t reply_len;
reply_len = sizeof(reply) - 1;
if (wpagui->ctrlRequest(cmd, reply, &reply_len) < 0)
return;
return false;
reply[reply_len] = '\0';
QString bss(reply);
if (bss.isEmpty() || bss.startsWith("FAIL"))
return;
return false;
QString ssid, bssid, flags, wps_name, pri_dev_type;
int id = -1;
@ -403,6 +403,8 @@ void Peers::add_bss(const char *cmd)
item->setData(ssid, peer_role_ssid);
model.appendRow(item);
}
return true;
}
@ -417,7 +419,8 @@ void Peers::add_scan_results()
if (index > 1000)
break;
add_bss(cmd);
if (!add_bss(cmd))
break;
}
}

View file

@ -49,7 +49,7 @@ private:
void add_station(QString info);
void add_stations();
void add_single_station(const char *addr);
void add_bss(const char *cmd);
bool add_bss(const char *cmd);
void remove_bss(int id);
void add_scan_results();
void update_peers();