]> source.dussan.org Git - rspamd.git/commitdiff
TCP Connect robot keyword 2610/head
authorAnton Yuzhaninov <citrin+git@citrin.ru>
Thu, 25 Oct 2018 01:08:31 +0000 (21:08 -0400)
committerAnton Yuzhaninov <citrin+git@citrin.ru>
Thu, 25 Oct 2018 01:28:47 +0000 (21:28 -0400)
* reduce timeout to a reasonable value
* explicitly close socket, don't wait for GC

test/functional/lib/rspamd.py

index e4462c18cc4ee751ad1bcd575d5a921719897822..6fc1c0e67026756fbd06b393a2e2601727d6513d 100644 (file)
@@ -160,8 +160,15 @@ def spamc(addr, port, filename):
     return r.decode('utf-8')
 
 def TCP_Connect(addr, port):
+    """Attempts to open a TCP connection to specified address:port
+
+    Example:
+    | Wait Until Keyword Succeeds | 5s | 10ms | TCP Connect | localhost | 8080 |
+    """
     s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+    s.settimeout(5) # seconds
     s.connect((addr, port))
+    s.close()
 
 def update_dictionary(a, b):
     a.update(b)