Soft Patch Panel
 help / color / mirror / Atom feed
* [spp] [PATCH 1/5] Add SO_REUSEADDR option
@ 2017-07-18 18:57 ogawa.yasufumi
  2017-07-18 18:57 ` [spp] [PATCH 2/5] Remove unwanted spaces from the sec command ogawa.yasufumi
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: ogawa.yasufumi @ 2017-07-18 18:57 UTC (permalink / raw)
  To: spp; +Cc: ferruh.yigit, sy.jong.choi, Yasufumi Ogawa

From: Yasufumi Ogawa <ogawa.yasufumi@lab.ntt.co.jp>

spp.py cannot be launched if it is terminated for unexpected error
and try to restart because of 'port is already used'.
This patch is for avoiding the situation by releasing port
immediately when spp.py is treminated.

Signed-off-by: Yasufumi Ogawa <ogawa.yasufumi@lab.ntt.co.jp>
---
 src/spp.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/spp.py b/src/spp.py
index b937b5a..01aed23 100755
--- a/src/spp.py
+++ b/src/spp.py
@@ -394,6 +394,7 @@ def main(argv):
 
     #Creating primary socket object
     primary_sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+    primary_sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
 
     #Binding primary socket to a address. bind() takes tuple of host and port.
     primary_sock.bind((host, primary_port))
@@ -408,6 +409,7 @@ def main(argv):
 
     #Creating secondary socket object
     secondary_sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+    secondary_sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
 
     #Binding secondary socket to a address. bind() takes tuple of host and port.
     secondary_sock.bind((host, secondary_port))
-- 
2.13.1

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-08-04 15:58 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-18 18:57 [spp] [PATCH 1/5] Add SO_REUSEADDR option ogawa.yasufumi
2017-07-18 18:57 ` [spp] [PATCH 2/5] Remove unwanted spaces from the sec command ogawa.yasufumi
2017-07-18 18:57 ` [spp] [PATCH 3/5] Add management port ogawa.yasufumi
2017-07-18 18:57 ` [spp] [PATCH 4/5] Correct sec command completion ogawa.yasufumi
2017-07-18 18:57 ` [spp] [PATCH 5/5] Add completion for bye command ogawa.yasufumi
2017-08-04 15:57 ` [spp] [PATCH 1/5] Add SO_REUSEADDR option Ferruh Yigit

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).