summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChia-chi Yeh <chiachi@android.com>2011-12-08 16:35:09 -0800
committerChia-chi Yeh <chiachi@android.com>2011-12-08 16:35:09 -0800
commit35c31502e9811c7ecd430a89f2b3ae03ca7d277a (patch)
tree1d0673e48d39d162ce73f22b46d6ffff24588bbe
parent0269612ac00a0700997dda333faf0a3c33a388b8 (diff)
downloadmtpd-ics-mr1-release.tar.gz
Before processing any packets, we check the presence of an "abort" file. If that exists, shut down our VPN layers. The performance impact is negligible as control packets are rare. Bug: 5714296 Change-Id: I076cc1afd7c7ef173bc93a6c4c105d08f8cc7686
-rw-r--r--mtpd.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/mtpd.c b/mtpd.c
index f65043e..cff5712 100644
--- a/mtpd.c
+++ b/mtpd.c
@@ -193,14 +193,19 @@ int main(int argc, char **argv)
log_print(FATAL, "Poll() %s", strerror(errno));
exit(SYSTEM_ERROR);
}
- timeout = pollfds[0].revents ?
- the_protocol->process() : the_protocol->timeout();
if (pollfds[1].revents) {
break;
}
if (pollfds[2].revents) {
interrupt(SIGTERM);
}
+#ifdef ANDROID_CHANGES
+ if (!access("/data/misc/vpn/abort", F_OK)) {
+ interrupt(SIGTERM);
+ }
+#endif
+ timeout = pollfds[0].revents ?
+ the_protocol->process() : the_protocol->timeout();
}
if (timeout < 0) {