Move shutdown out of linger and make it variable on tlssocks. - geomyidae - A small C-based gopherd.
git clone git://bitreich.org/geomyidae/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/geomyidae/
Log
Files
Refs
Tags
README
LICENSE
---
commit ccbe2e7bf5613a77a9e1f2e29ff037c08755cdb0
parent fe5c840d34c12bc38be14397144731b9f46ecec8
Author: Christoph Lohmann <20h@r-36.net>
Date:   Sat, 12 Aug 2023 21:37:16 +0200

Move shutdown out of linger and make it variable on tlssocks.

Diffstat:
  M ind.c                               |       1 -
  M main.c                              |       3 +++

2 files changed, 3 insertions(+), 1 deletion(-)
---
diff --git a/ind.c b/ind.c
@@ -653,7 +653,6 @@ lingersock(int sock)
         waitforpendingbytes(sock);
         j = 0;
         setsockopt(sock, IPPROTO_TCP, TCP_NODELAY, &j, sizeof(int));
-        shutdown(sock, SHUT_RDWR);
 
         return;
 }
diff --git a/main.c b/main.c
@@ -1174,6 +1174,8 @@ read_selector_again:
                                         }
 
                                         lingersock(tlssocks[tlsclientreader? 0 : 1]);
+                                        shutdown(tlssocks[tlsclientreader? 0 : 1],
+                                                        tlsclientreader? SHUT_WR : SHUT_RD);
                                         close(tlssocks[tlsclientreader? 0 : 1]);
 
                                         if (tlsclientreader) {
@@ -1192,6 +1194,7 @@ read_selector_again:
                                         nocgi, istls);
 
                         lingersock(sock);
+                        shutdown(sock, SHUT_RDWR);
                         close(sock);
 
                         if (loglvl & CONN) {