summaryrefslogtreecommitdiffstats
path: root/cmds
diff options
context:
space:
mode:
authorChristopher Ferris <cferris@google.com>2014-10-01 17:35:01 -0700
committerChristopher Ferris <cferris@google.com>2014-10-01 17:35:01 -0700
commited9354fc846895dc53397fbb5323bef00b3a3834 (patch)
treedf49c38cc71892400d25deca98b1a4c9a5eb7d62 /cmds
parent5ee2c9d20c0fbecf6b4a482eb8d8bfdf85d0d424 (diff)
downloadframeworks_native-ed9354fc846895dc53397fbb5323bef00b3a3834.zip
frameworks_native-ed9354fc846895dc53397fbb5323bef00b3a3834.tar.gz
frameworks_native-ed9354fc846895dc53397fbb5323bef00b3a3834.tar.bz2
Accept socket connection before tracing.
Sometimes dumping threads takes a long time and bugreport times out. This change will cause us to accept the bugreport socket connection before dumping threads and should avoid the failed to connect to dumpstate service problems we've seen. Bug: 17758374 Change-Id: I80afa0353cf1c340873f481a8d1d7faffff54120
Diffstat (limited to 'cmds')
-rw-r--r--cmds/dumpstate/dumpstate.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/cmds/dumpstate/dumpstate.c b/cmds/dumpstate/dumpstate.c
index f142095..1fbcef6 100644
--- a/cmds/dumpstate/dumpstate.c
+++ b/cmds/dumpstate/dumpstate.c
@@ -438,6 +438,12 @@ int main(int argc, char *argv[]) {
}
}
+ // If we are going to use a socket, do it as early as possible
+ // to avoid timeouts from bugreport.
+ if (use_socket) {
+ redirect_to_socket(stdout, "dumpstate");
+ }
+
/* open the vibrator before dropping root */
FILE *vibrator = 0;
if (do_vibrate) {
@@ -504,9 +510,7 @@ int main(int argc, char *argv[]) {
char path[PATH_MAX], tmp_path[PATH_MAX];
pid_t gzip_pid = -1;
- if (use_socket) {
- redirect_to_socket(stdout, "dumpstate");
- } else if (use_outfile) {
+ if (!use_socket && use_outfile) {
strlcpy(path, use_outfile, sizeof(path));
if (do_add_date) {
char date[80];