This is an automated email from the ASF dual-hosted git repository.

vatamane pushed a commit to branch monitor-client-socket-for-disconnections
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit 3f69a59dd7b07d8bf6343e00f6728258173f0331
Author: Nick Vatamaniuc <[email protected]>
AuthorDate: Wed Aug 23 19:08:58 2023 -0400

    [fixup] tcp_fsm.h are the same on FreeBSD and MacOS
---
 src/chttpd/src/chttpd_util.erl | 23 +++++------------------
 1 file changed, 5 insertions(+), 18 deletions(-)

diff --git a/src/chttpd/src/chttpd_util.erl b/src/chttpd/src/chttpd_util.erl
index fe51f85ca..2601ba7dc 100644
--- a/src/chttpd/src/chttpd_util.erl
+++ b/src/chttpd/src/chttpd_util.erl
@@ -183,10 +183,10 @@ tcp_info_opt({unix, darwin}) ->
     {raw, 6, 16#106, 1};
 tcp_info_opt({unix, freebsd}) ->
     %% sys/netinet/in.h
-    %%  #define  IPPROTO_TCP  6 /* tcp */
+    %%   #define  IPPROTO_TCP  6
     %%
     %% sys/netinet/tcp.h
-    %%  #define  TCP_INFO    32 /* retrieve tcp_info structure */
+    %%   #define  TCP_INFO    32
     %%
     {raw, 6, 32, 1};
 tcp_info_opt({_, _}) ->
@@ -210,7 +210,9 @@ tcp_is_closed(State, {unix, linux}) ->
     %%   }
     %%
     lists:member(State, [4, 5, 6, 7, 8, 9, 10]);
-tcp_is_closed(State, {unix, darwin}) ->
+tcp_is_closed(State, {unix, Type}) when Type =:= darwin; Type =:= freebsd ->
+    %% tcp_fsm.h states are the same on macos and freebsd
+    %%
     %% netinet/tcp_fsm.h
     %%   #define TCPS_CLOSED             0       /* closed */
     %%   #define TCPS_LISTEN             1       /* listening for connection */
@@ -224,19 +226,4 @@ tcp_is_closed(State, {unix, darwin}) ->
     %%   #define TCPS_FIN_WAIT_2         9       /* have closed, fin is acked 
*/
     %%   #define TCPS_TIME_WAIT          10      /* in 2*msl quiet wait after 
close */
     %%
-    lists:member(State, [0, 5, 6, 7, 8, 9, 10]);
-tcp_is_closed(State, {unix, freebsd}) ->
-    %% netinet/tcp_fsm.h
-    %%   #define TCPS_CLOSED 0 /* closed */
-    %%   #define TCPS_LISTEN 1 /* listening for connection */
-    %%   #define TCPS_SYN_SENT 2  /* active, have sent syn */
-    %%   #define TCPS_SYN_RECEIVED 3 /* have sent and received syn */
-    %%   #define TCPS_ESTABLISHED 4 /* established */
-    %%   #define TCPS_CLOSE_WAIT 5 /* rcvd fin, waiting for close */
-    %%   #define TCPS_FIN_WAIT_1 6 /* have closed, sent fin */
-    %%   #define TCPS_CLOSING 7/* closed xchd FIN; await FIN ACK */
-    %%   #define TCPS_LAST_ACK 8/* had fin and close; await FIN ACK */
-    %%   #define TCPS_FIN_WAIT_2 9/* have closed, fin is acked */
-    %%   #define TCPS_TIME_WAIT 10 /* in 2*msl quiet wait after close */
-    %%
     lists:member(State, [0, 5, 6, 7, 8, 9, 10]).

Reply via email to