[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openocd-development
Subject:    [OpenOCD-devel] [PATCH]: c48c233 openocd: fix issue in WIN32 with TCP adapters [RFC]
From:       gerrit () openocd ! org (gerrit)
Date:       2020-02-14 23:36:54
Message-ID: 20200214233655.01D554A0046 () mail ! openocd ! org
[Download RAW message or body]

This is an automated email from Gerrit.

Tarek BOCHKATI (tarek.bouchkati@gmail.com) just uploaded a new patch set to Gerrit, \
which you can find at http://openocd.zylin.com/5456

-- gerrit

commit c48c233394cec4ce7815dc67cee530f3cb7282dd
Author: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Date:   Sat Feb 15 00:35:24 2020 +0100

    openocd: fix issue in WIN32 with TCP adapters [RFC]
    
    Issue: server_quit is called before adapter_quit:
      In WIN32 only in server_quit we do an WSACleanup,
      which terminates/closes all active sockets.
      So if the adapter is TCP based, the adapter.quit handler
      will fail if it will need to send some commands through TCP.
    
    Example: close_socket in jtag_vpi_quit will fail in WIN32
      because the socket is already closed
      and the errno is set as "Bad File Descriptor"
    
    The proposed solution is to move the adapter quit inside server_quit
    before WSACleanup call.
    
    Change-Id: Ie4afacafe123857f6ae300e376bdfcf0d8c027ac
    Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>

diff --git a/src/openocd.c b/src/openocd.c
index 2a9a0b3..1f9c0de 100644
--- a/src/openocd.c
+++ b/src/openocd.c
@@ -358,8 +358,6 @@ int openocd_main(int argc, char *argv[])
 	dap_cleanup_all();
 	arm_cti_cleanup_all();
 
-	adapter_quit();
-
 	/* Shutdown commandline interface */
 	command_exit(cmd_ctx);
 
diff --git a/src/server/server.c b/src/server/server.c
index 8e64117..5461daf 100644
--- a/src/server/server.c
+++ b/src/server/server.c
@@ -27,6 +27,7 @@
 #endif
 
 #include "server.h"
+#include <jtag/jtag.h>
 #include <target/target.h>
 #include <target/target_request.h>
 #include <target/openrisc/jsp_server.h>
@@ -686,6 +687,7 @@ int server_quit(void)
 {
 	remove_services();
 	target_quit();
+	adapter_quit();
 
 #ifdef _WIN32
 	WSACleanup();

-- 


_______________________________________________
OpenOCD-devel mailing list
OpenOCD-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openocd-devel


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic