am 804180b2: Merge "adb: fix a data race in local_socket_event_func."

* commit '804180b2ccf2ef4dedad7d136c060ecbdda7aac5':
  adb: fix a data race in local_socket_event_func.
This commit is contained in:
Yabin Cui 2015-08-27 05:22:52 +00:00 committed by Android Git Automerger
commit 860169cbf8

View file

@ -360,9 +360,12 @@ static void local_socket_event_func(int fd, unsigned ev, void* _s)
} else {
p->len = max_payload - avail;
// s->peer->enqueue() may call s->close() and free s,
// so save variables for debug printing below.
unsigned saved_id = s->id;
int saved_fd = s->fd;
r = s->peer->enqueue(s->peer, p);
D("LS(%d): fd=%d post peer->enqueue(). r=%d\n", s->id, s->fd,
r);
D("LS(%u): fd=%d post peer->enqueue(). r=%d\n", saved_id, saved_fd, r);
if (r < 0) {
/* error return means they closed us as a side-effect