[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[tyndur-devel] [PATCH] tcpip: Verbindung nicht doppelt schliessen



! tcpip: Wenn die Verbindung durch fclose geschlossen werden soll, die
  Gegenstelle aber bereits ihrerseits ein FIN geschickt hat, brauchen
  wir nicht nochmal ein neues FIN schicken und in einen Timeout rennen.

Signed-off-by: Kevin Wolf <kevin@xxxxxxxxxx>
---
 src/modules/tcpip/tcp.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/src/modules/tcpip/tcp.c b/src/modules/tcpip/tcp.c
index 60fb896..0ebb2e8 100644
--- a/src/modules/tcpip/tcp.c
+++ b/src/modules/tcpip/tcp.c
@@ -270,6 +270,13 @@ void tcp_close_connection(struct tcp_connection* conn)
 {
     uint64_t timeout;
 
+    if (conn->status == TCPS_WAIT_FOR_LAST_ACK
+        || conn->status == TCPS_CLOSED)
+    {
+        DEBUG_MSG("Verbindung ist schon geschlossen");
+        return;
+    }
+
     DEBUG_MSG("tcp_send_fin_ack");
     conn->status = TCPS_WAIT_FOR_FIN_ACK;
     tcp_send_fin(conn, FALSE);
-- 
1.6.0.2