• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

system/corennnnn


Commit MetaInfo

Revision67340391ebd4f272f9d4696b55e7e555d0950c34 (tree)
Time2016-09-21 14:45:29
AuthorChih-Wei Huang <cwhuang@linu...>
CommiterChih-Wei Huang

Log Message

Merge remote-tracking branch 'x86/marshmallow-x86' into cm-13.0-x86

Change Summary

Incremental Difference

--- a/adb/adb.h
+++ b/adb/adb.h
@@ -85,13 +85,6 @@ struct asocket {
8585 ** but packets are still queued for delivery
8686 */
8787 int closing;
88- /* flag: set when this socket is running.
89- */
90- int running;
91- /* flag: force close this socket. if this socket is running, other
92- ** thread set this flag to request close it.
93- */
94- int force_close;
9588
9689 /* flag: quit adbd when both ends close the
9790 ** local service socket
--- a/adb/sockets.cpp
+++ b/adb/sockets.cpp
@@ -116,12 +116,12 @@ void remove_socket(asocket *s)
116116 }
117117 }
118118
119-// Note: after return, all sockets refer to transport @t should be closed.
120-// (Because the atransport is going to removed.)
121-// force_close && running flag are to implement this.
122119 void close_all_sockets(atransport *t)
123120 {
124121 asocket *s;
122+ /* this is a little gross, but since s->close() *will* modify
123+ ** the list out from under you, your options are limited.
124+ */
125125 std::lock_guard<recursive_mutex> lock(local_socket_list_lock);
126126 restart:
127127 for (s = local_socket_list.next; s != &local_socket_list; s = s->next) {
@@ -238,10 +238,9 @@ static void local_socket_close(asocket* s) {
238238 }
239239
240240 /* If we are already closing, or if there are no
241- ** pending packets, or need force close it, then
242- ** destroy immediately.
241+ ** pending packets, destroy immediately
243242 */
244- if (s->closing || s->force_close || s->pkt_first == NULL) {
243+ if (s->closing || s->pkt_first == NULL) {
245244 int id = s->id;
246245 local_socket_destroy(s);
247246 D("LS(%d): closed\n", id);
@@ -261,12 +260,8 @@ static void local_socket_close(asocket* s) {
261260 static void local_socket_event_func(int fd, unsigned ev, void* _s)
262261 {
263262 asocket* s = reinterpret_cast<asocket*>(_s);
264- s->running = 1;
265263 D("LS(%d): event_func(fd=%d(==%d), ev=%04x)\n", s->id, s->fd, fd, ev);
266264
267- if (s->force_close)
268- goto out;
269-
270265 /* put the FDE_WRITE processing before the FDE_READ
271266 ** in order to simplify the code.
272267 */
@@ -280,7 +275,7 @@ static void local_socket_event_func(int fd, unsigned ev, void* _s)
280275 ** be processed in the next iteration loop
281276 */
282277 if (errno == EAGAIN) {
283- goto out;
278+ return;
284279 }
285280 } else if (r > 0) {
286281 p->ptr += r;
@@ -289,7 +284,6 @@ static void local_socket_event_func(int fd, unsigned ev, void* _s)
289284 }
290285
291286 D(" closing after write because r=%d and errno is %d\n", r, errno);
292- s->running = 0;
293287 s->close(s);
294288 return;
295289 }
@@ -308,7 +302,6 @@ static void local_socket_event_func(int fd, unsigned ev, void* _s)
308302 */
309303 if (s->closing) {
310304 D(" closing because 'closing' is set after write\n");
311- s->running = 0;
312305 s->close(s);
313306 return;
314307 }
@@ -367,7 +360,7 @@ static void local_socket_event_func(int fd, unsigned ev, void* _s)
367360 ** this handler function will be called again
368361 ** to process FDE_WRITE events.
369362 */
370- goto out;
363+ return;
371364 }
372365
373366 if (r > 0) {
@@ -382,9 +375,7 @@ static void local_socket_event_func(int fd, unsigned ev, void* _s)
382375 if ((s->fde.force_eof && !r) || is_eof) {
383376 D(" closing because is_eof=%d r=%d s->fde.force_eof=%d\n",
384377 is_eof, r, s->fde.force_eof);
385- s->running = 0;
386378 s->close(s);
387- return;
388379 }
389380 }
390381
@@ -395,13 +386,7 @@ static void local_socket_event_func(int fd, unsigned ev, void* _s)
395386 */
396387 D("LS(%d): FDE_ERROR (fd=%d)\n", s->id, s->fd);
397388
398- goto out;
399- }
400-out:
401- s->running = 0;
402- if (s->force_close) {
403- D("LS(%d): force closing (fd=%d)\n", s->id, s->fd);
404- s->close(s);
389+ return;
405390 }
406391 }
407392
@@ -409,7 +394,6 @@ asocket *create_local_socket(int fd)
409394 {
410395 asocket *s = reinterpret_cast<asocket*>(calloc(1, sizeof(asocket)));
411396 if (s == NULL) fatal("cannot allocate socket");
412- memset(s, 0, sizeof(asocket));
413397 s->fd = fd;
414398 s->enqueue = local_socket_enqueue;
415399 s->ready = local_socket_ready;
@@ -555,7 +539,6 @@ asocket *create_remote_socket(unsigned id, atransport *t)
555539 adisconnect* dis = &reinterpret_cast<aremotesocket*>(s)->disconnect;
556540
557541 if (s == NULL) fatal("cannot allocate socket");
558- memset(s, 0, sizeof(asocket));
559542 s->id = id;
560543 s->enqueue = remote_socket_enqueue;
561544 s->ready = remote_socket_ready;
@@ -888,7 +871,6 @@ static asocket *create_smart_socket(void)
888871 D("Creating smart socket \n");
889872 asocket *s = reinterpret_cast<asocket*>(calloc(1, sizeof(asocket)));
890873 if (s == NULL) fatal("cannot allocate socket");
891- memset(s, 0, sizeof(asocket));
892874 s->enqueue = smart_socket_enqueue;
893875 s->ready = smart_socket_ready;
894876 s->shutdown = NULL;