Soft Patch Panel
 help / color / mirror / Atom feed
From: ogawa.yasufumi@lab.ntt.co.jp
To: spp@dpdk.org
Cc: ferruh.yigit@intel.com, sy.jong.choi@intel.com,
	Yasufumi Ogawa <ogawa.yasufumi@lab.ntt.co.jp>
Subject: [spp] [PATCH 1/5] Add SO_REUSEADDR option
Date: Wed, 19 Jul 2017 03:57:25 +0900	[thread overview]
Message-ID: <20170718185729.76668-1-ogawa.yasufumi@lab.ntt.co.jp> (raw)

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

             reply	other threads:[~2017-07-18 18:57 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-18 18:57 ogawa.yasufumi [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170718185729.76668-1-ogawa.yasufumi@lab.ntt.co.jp \
    --to=ogawa.yasufumi@lab.ntt.co.jp \
    --cc=ferruh.yigit@intel.com \
    --cc=spp@dpdk.org \
    --cc=sy.jong.choi@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).