summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Herrmann <dh.herrmann@gmail.com>2014-02-08 18:54:40 +0100
committerDavid Herrmann <dh.herrmann@gmail.com>2014-02-08 18:54:40 +0100
commitc69812297e1534f97fdca635fcab62f1686c35aa (patch)
treeba8e6459c731e782c2ce94825612f9075ff553cb
parent4d8089697f1bcc494e80f7f5e12ffaa8ecf1282a (diff)
wpa: reduce DETACH timeout to 10ms
There's really no need to wait for DETACH to complete. We do not only for compatibility and to make sure the message is actually transmitted. However, if wpa-supplicant is currently terminating, the message might be in the queue, but not processed. We thus don't get any ECONNREFUSED and wait for 10s for an answer.. That's just awful. Set it to 10ms for now as that seems to work just fine. Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
-rw-r--r--src/wpa_ctrl.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/wpa_ctrl.c b/src/wpa_ctrl.c
index 34b626a..e266c2b 100644
--- a/src/wpa_ctrl.c
+++ b/src/wpa_ctrl.c
@@ -325,6 +325,7 @@ _shl_public_
int wfd_wpa_ctrl_open(struct wfd_wpa_ctrl *wpa, const char *ctrl_path)
{
int r;
+ int64_t t = 1000LL * 10; /* 10ms */
if (!wpa || !ctrl_path)
return -EINVAL;
@@ -355,7 +356,7 @@ int wfd_wpa_ctrl_open(struct wfd_wpa_ctrl *wpa, const char *ctrl_path)
return 0;
err_ev:
- wpa_request_ok(wpa->ev_fd, "DETACH", 6, NULL, &wpa->mask);
+ wpa_request_ok(wpa->ev_fd, "DETACH", 6, &t, &wpa->mask);
close_socket(wpa, wpa->ev_fd, wpa->ev_name);
wpa->ev_fd = -1;
err_req:
@@ -369,10 +370,12 @@ err_timer:
_shl_public_
void wfd_wpa_ctrl_close(struct wfd_wpa_ctrl *wpa)
{
+ int64_t t = 1000LL * 10; /* 10ms */
+
if (!wpa || !wfd_wpa_ctrl_is_open(wpa))
return;
- wpa_request_ok(wpa->ev_fd, "DETACH", 6, NULL, &wpa->mask);
+ wpa_request_ok(wpa->ev_fd, "DETACH", 6, &t, &wpa->mask);
close_socket(wpa, wpa->ev_fd, wpa->ev_name);
wpa->ev_fd = -1;