All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Paul Barker" <pbarker@konsulko.com>
To: bitbake-devel@lists.openembedded.org,
	Richard Purdie <richard.purdie@linuxfoundation.org>,
	Joshua Watt <JPEWhacker@gmail.com>
Cc: Paul Barker <pbarker@konsulko.com>
Subject: [PATCH 2/4] asyncrpc: Avoid duplicate sockets in TCP server
Date: Fri, 28 May 2021 09:42:07 +0100	[thread overview]
Message-ID: <20210528084209.8408-3-pbarker@konsulko.com> (raw)
In-Reply-To: <20210528084209.8408-1-pbarker@konsulko.com>

Calling asyncio.start_server with host='localhost' results in two
sockets being opened with different port numbers (one for IPv4 and one
for IPv6):

    NOTE: Listening on ('127.0.0.1', 38833)
    NOTE: Listening on ('::1', 42029, 0, 0)

This is unnecessary and can be avoided by passing host='127.0.0.1'.

Signed-off-by: Paul Barker <pbarker@konsulko.com>
---
 lib/bb/asyncrpc/serv.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lib/bb/asyncrpc/serv.py b/lib/bb/asyncrpc/serv.py
index fd91aa71a..003a118b7 100644
--- a/lib/bb/asyncrpc/serv.py
+++ b/lib/bb/asyncrpc/serv.py
@@ -142,6 +142,9 @@ class AsyncServer(object):
         self.logger = logger
 
     def start_tcp_server(self, host, port):
+        if host == 'localhost':
+            host = '127.0.0.1'
+
         self.server = self.loop.run_until_complete(
             asyncio.start_server(self.handle_client, host, port, loop=self.loop)
         )
-- 
2.26.2


  parent reply	other threads:[~2021-05-28  8:42 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-28  8:42 [PATCH 0/4] Re-implement prserv on top of asyncrpc Paul Barker
2021-05-28  8:42 ` [PATCH 1/4] asyncrpc: Add ping method Paul Barker
2021-05-28  8:42 ` Paul Barker [this message]
2021-06-02 14:38   ` [PATCH 2/4] asyncrpc: Avoid duplicate sockets in TCP server Joshua Watt
2021-06-07 13:51     ` Paul Barker
2021-05-28  8:42 ` [PATCH 3/4] asyncrpc: Reduce verbosity Paul Barker
2021-05-28  8:42 ` [PATCH 4/4] prserv: Replace XML RPC with modern asyncrpc implementation Paul Barker
2021-05-31 11:25 ` [PATCH 0/4] Re-implement prserv on top of asyncrpc Richard Purdie
2021-05-31 14:45   ` Paul Barker

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=20210528084209.8408-3-pbarker@konsulko.com \
    --to=pbarker@konsulko.com \
    --cc=JPEWhacker@gmail.com \
    --cc=bitbake-devel@lists.openembedded.org \
    --cc=richard.purdie@linuxfoundation.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.