[Tarantool-patches] [PATCH v1 3/4] test: enable SO_REUSEADDR on socket in httpd.py
Sergey Bronnikov
sergeyb at tarantool.org
Thu Jan 14 12:57:21 MSK 2021
Thanks for review!
On 14.01.2021 12:09, Leonid Vasiliev wrote:
> Hi! Thank you for the patch.
> LGTM.
>
> This is a popular technique.
> But I don't understand:"Why is it needed when python3 is used, but not
> needed for python2?" If you know, share with me, if not, let it remain a
> mystery.
Last two commits are not related to python 3 support and I didn't state it.
These patches are useful changes that I decided to add to the series.
>
> On 13.01.2021 11:48, sergeyb at tarantool.org wrote:
>> From: Sergey Bronnikov <sergeyb at tarantool.org>
>>
>> TL;DR httpd.py warns that port is busy when restart server. With socket
>> option SO_REUSEADDR it allows to restart httpd.py without problem.
>>
>> Socket option SO_REUSEADDR tells the kernel that even if this port is
>> busy, go ahead and reuse it anyway. If it is busy, but with another
>> state, you will still get an address already in use error. It is useful
>> if your server has been shut down, and then restarted right away while
>> sockets are still active on its port.
>> ---
>> test/app-tap/httpd.py | 1 +
>> 1 file changed, 1 insertion(+)
>>
>> diff --git a/test/app-tap/httpd.py b/test/app-tap/httpd.py
>> index 62435e91a..60084bdbf 100755
>> --- a/test/app-tap/httpd.py
>> +++ b/test/app-tap/httpd.py
>> @@ -138,6 +138,7 @@ else:
>> usage()
>> sock = socket.socket(sock_family, socket.SOCK_STREAM)
>> +sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
>> sock.bind(sock_addr)
>> sock.listen(10)
>>
More information about the Tarantool-patches
mailing list