From 44d6ba08227977a73b87e2bd37c47518954a0f96 Mon Sep 17 00:00:00 2001
From: phil <phil@secdev.org>
Date: Fri, 17 Mar 2017 14:52:29 +0100
Subject: [PATCH] Fix TCP*Pipe stop() method

---
 scapy/scapypipes.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/scapy/scapypipes.py b/scapy/scapypipes.py
index 90e5b8d5..c4685d5c 100644
--- a/scapy/scapypipes.py
+++ b/scapy/scapypipes.py
@@ -161,7 +161,8 @@ class TCPConnectPipe(Source):
         self.fd = socket.socket()
         self.fd.connect((self.addr,self.port))
     def stop(self):
-        self.fd.close()
+        if self.fd:
+            self.fd.close()
     def push(self, msg):
         self.fd.send(msg)
     def fileno(self):
-- 
GitLab