From owner-svn-soc-all@freebsd.org Fri Aug 21 16:19:36 2015 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 411C29BF88D for ; Fri, 21 Aug 2015 16:19:36 +0000 (UTC) (envelope-from roam@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 323F9113 for ; Fri, 21 Aug 2015 16:19:36 +0000 (UTC) (envelope-from roam@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id t7LGJajT044734 for ; Fri, 21 Aug 2015 16:19:36 GMT (envelope-from roam@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id t7LGJZSD044731 for svn-soc-all@FreeBSD.org; Fri, 21 Aug 2015 16:19:35 GMT (envelope-from roam@FreeBSD.org) Date: Fri, 21 Aug 2015 16:19:35 GMT Message-Id: <201508211619.t7LGJZSD044731@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to roam@FreeBSD.org using -f From: roam@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r290031 - soc2015/roam/ayiya_resp MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Aug 2015 16:19:36 -0000 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;