]> git.gag.com Git - fw/openocd/commit
openocd: fix issue in WIN32 with TCP adapters
authorTarek BOCHKATI <tarek.bouchkati@gmail.com>
Thu, 23 Apr 2020 10:00:31 +0000 (11:00 +0100)
committerAntonio Borneo <borneo.antonio@gmail.com>
Sun, 14 Jun 2020 13:23:48 +0000 (14:23 +0100)
commit9a690c6bdb18d722a99d5752ac9c3ae1733cf22e
treecad6d8490670f0b4e2deb340cf8a46255b5b2629
parent7e78c04f1c275176bdee8f9d2553300218164577
openocd: fix issue in WIN32 with TCP adapters

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"

To fix that we introduced new functions called server_host_os_entry/quit
to manage specific OS setup (hence WSA for sockets in WINDOWS) in order
to delay WSACleanup after adapter_quit().

Change-Id: Ie4afacafe123857f6ae300e376bdfcf0d8c027ac
Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-on: http://openocd.zylin.com/5456
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
src/openocd.c
src/server/server.c
src/server/server.h