Detach ctrl_iface monitor if the client socket is removed
No need to wait for 10 errors when using UNIX domain socket; we can detach the client immediately on ENOENT.
This commit is contained in:
parent
2943799678
commit
c5aaa01562
2 changed files with 10 additions and 6 deletions
|
@ -570,11 +570,12 @@ static void hostapd_ctrl_iface_send(struct hostapd_data *hapd, int level,
|
||||||
msg.msg_name = &dst->addr;
|
msg.msg_name = &dst->addr;
|
||||||
msg.msg_namelen = dst->addrlen;
|
msg.msg_namelen = dst->addrlen;
|
||||||
if (sendmsg(hapd->ctrl_sock, &msg, 0) < 0) {
|
if (sendmsg(hapd->ctrl_sock, &msg, 0) < 0) {
|
||||||
fprintf(stderr, "CTRL_IFACE monitor[%d]: ",
|
int _errno = errno;
|
||||||
idx);
|
wpa_printf(MSG_INFO, "CTRL_IFACE monitor[%d]: "
|
||||||
perror("sendmsg");
|
"%d - %s",
|
||||||
|
idx, errno, strerror(errno));
|
||||||
dst->errors++;
|
dst->errors++;
|
||||||
if (dst->errors > 10) {
|
if (dst->errors > 10 || _errno == ENOENT) {
|
||||||
hostapd_ctrl_iface_detach(
|
hostapd_ctrl_iface_detach(
|
||||||
hapd, &dst->addr,
|
hapd, &dst->addr,
|
||||||
dst->addrlen);
|
dst->addrlen);
|
||||||
|
|
|
@ -514,9 +514,12 @@ static void wpa_supplicant_ctrl_iface_send(struct ctrl_iface_priv *priv,
|
||||||
msg.msg_name = (void *) &dst->addr;
|
msg.msg_name = (void *) &dst->addr;
|
||||||
msg.msg_namelen = dst->addrlen;
|
msg.msg_namelen = dst->addrlen;
|
||||||
if (sendmsg(priv->sock, &msg, 0) < 0) {
|
if (sendmsg(priv->sock, &msg, 0) < 0) {
|
||||||
perror("sendmsg(CTRL_IFACE monitor)");
|
int _errno = errno;
|
||||||
|
wpa_printf(MSG_INFO, "CTRL_IFACE monitor[%d]: "
|
||||||
|
"%d - %s",
|
||||||
|
idx, errno, strerror(errno));
|
||||||
dst->errors++;
|
dst->errors++;
|
||||||
if (dst->errors > 10) {
|
if (dst->errors > 10 || _errno == ENOENT) {
|
||||||
wpa_supplicant_ctrl_iface_detach(
|
wpa_supplicant_ctrl_iface_detach(
|
||||||
priv, &dst->addr,
|
priv, &dst->addr,
|
||||||
dst->addrlen);
|
dst->addrlen);
|
||||||
|
|
Loading…
Reference in a new issue