socsvn commit: r290031 - soc2015/roam/ayiya_resp
roam at FreeBSD.org
roam at FreeBSD.org
Fri Aug 21 16:19:36 UTC 2015
Author: roam
Date: Fri Aug 21 16:19:35 2015
New Revision: 290031
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=290031
Log:
ayiya_resp: handle losing the listener.
When a tunnel is reestablished with a different peer, ayiya_listen
will close the socket to the currently running ayiya_resp process;
deal with this gracefully and exit instead of outputting a barrage
of incorrect diagnostic messages until ayiya_listen kills it.
ObQuote: "It's so funny how we don't talk anymore"
Modified:
soc2015/roam/ayiya_resp/main.c
Modified: soc2015/roam/ayiya_resp/main.c
==============================================================================
--- soc2015/roam/ayiya_resp/main.c Fri Aug 21 16:18:53 2015 (r290030)
+++ soc2015/roam/ayiya_resp/main.c Fri Aug 21 16:19:35 2015 (r290031)
@@ -328,6 +328,7 @@
if (sel & A_SEL_RD_INPUT) {
debug("The listener's trying to tell us something!\n");
+ bool got_data = false;
while (true) {
const ssize_t n = read(inputfd, inbuf + inofs, sizeof(inbuf) - inofs);
if (n == -1) {
@@ -335,9 +336,14 @@
break;
err(1, "Could not read from the listener input channel");
}
- if (n == 0)
- break;
+ if (n == 0) {
+ if (got_data)
+ break;
+ warnx("The listener closed the socket, giving up");
+ exit(0);
+ }
assert(n > 0);
+ got_data = true;
inofs += (size_t)n;
size_t bite;
More information about the svn-soc-all
mailing list