net/py-ephemeral_port_reserve: import py-ephemeral_port_reserve-1.1.4
Sometimes you need a networked program to bind to a port that can't be hard-coded. Generally this is when you want to run several of them in parallel; if they all bind to port 8080, only one of them can succeed. The usual solution is the "port 0 trick". If you bind to port 0, your kernel will find some arbitrary high-numbered port that's unused and bind to that. Afterward you can query the actual port that was bound to if you need to use the port number elsewhere. However, there are cases where the port 0 trick won't work. For example, mysqld takes port 0 to mean "the port configured in my.cnf". Docker can bind your containers to port 0, but uses its own implementation to find a free port which races and fails in the face of parallelism. ephemeral-port-reserve provides an implementation of the port 0 trick which is reliable and race-free.
This commit is contained in:
parent
ff658cc018
commit
fb152a4b15
5 changed files with 50 additions and 0 deletions
1
net/py-ephemeral_port_reserve/ALTERNATIVES
Normal file
1
net/py-ephemeral_port_reserve/ALTERNATIVES
Normal file
|
@ -0,0 +1 @@
|
|||
bin/ephemeral-port-reserve @PREFIX@/bin/ephemeral-port-reserve-@PYVERSSUFFIX@
|
17
net/py-ephemeral_port_reserve/DESCR
Normal file
17
net/py-ephemeral_port_reserve/DESCR
Normal file
|
@ -0,0 +1,17 @@
|
|||
Sometimes you need a networked program to bind to a port that can't
|
||||
be hard-coded. Generally this is when you want to run several of
|
||||
them in parallel; if they all bind to port 8080, only one of them
|
||||
can succeed.
|
||||
|
||||
The usual solution is the "port 0 trick". If you bind to port 0,
|
||||
your kernel will find some arbitrary high-numbered port that's
|
||||
unused and bind to that. Afterward you can query the actual port
|
||||
that was bound to if you need to use the port number elsewhere.
|
||||
However, there are cases where the port 0 trick won't work. For
|
||||
example, mysqld takes port 0 to mean "the port configured in my.cnf".
|
||||
Docker can bind your containers to port 0, but uses its own
|
||||
implementation to find a free port which races and fails in the
|
||||
face of parallelism.
|
||||
|
||||
ephemeral-port-reserve provides an implementation of the port 0
|
||||
trick which is reliable and race-free.
|
17
net/py-ephemeral_port_reserve/Makefile
Normal file
17
net/py-ephemeral_port_reserve/Makefile
Normal file
|
@ -0,0 +1,17 @@
|
|||
# $NetBSD: Makefile,v 1.1 2022/04/29 13:05:35 wiz Exp $
|
||||
|
||||
DISTNAME= ephemeral_port_reserve-1.1.4
|
||||
PKGNAME= ${PYPKGPREFIX}-${DISTNAME}
|
||||
CATEGORIES= net python
|
||||
MASTER_SITES= ${MASTER_SITE_PYPI:=e/ephemeral_port_reserve/}
|
||||
|
||||
MAINTAINER= pkgsrc-users@NetBSD.org
|
||||
HOMEPAGE= https://github.com/Yelp/ephemeral-port-reserve/
|
||||
COMMENT= Bind to ephemeral port, force it into TIME_WAIT state, and unbind it
|
||||
LICENSE= mit
|
||||
|
||||
post-install:
|
||||
${MV} ${DESTDIR}${PREFIX}/bin/ephemeral-port-reserve ${DESTDIR}${PREFIX}/bin/ephemeral-port-reserve-${PYVERSSUFFIX} || ${TRUE}
|
||||
|
||||
.include "../../lang/python/egg.mk"
|
||||
.include "../../mk/bsd.pkg.mk"
|
10
net/py-ephemeral_port_reserve/PLIST
Normal file
10
net/py-ephemeral_port_reserve/PLIST
Normal file
|
@ -0,0 +1,10 @@
|
|||
@comment $NetBSD: PLIST,v 1.1 2022/04/29 13:05:35 wiz Exp $
|
||||
bin/ephemeral-port-reserve-${PYVERSSUFFIX}
|
||||
${PYSITELIB}/${EGG_INFODIR}/PKG-INFO
|
||||
${PYSITELIB}/${EGG_INFODIR}/SOURCES.txt
|
||||
${PYSITELIB}/${EGG_INFODIR}/dependency_links.txt
|
||||
${PYSITELIB}/${EGG_INFODIR}/entry_points.txt
|
||||
${PYSITELIB}/${EGG_INFODIR}/top_level.txt
|
||||
${PYSITELIB}/ephemeral_port_reserve.py
|
||||
${PYSITELIB}/ephemeral_port_reserve.pyc
|
||||
${PYSITELIB}/ephemeral_port_reserve.pyo
|
5
net/py-ephemeral_port_reserve/distinfo
Normal file
5
net/py-ephemeral_port_reserve/distinfo
Normal file
|
@ -0,0 +1,5 @@
|
|||
$NetBSD: distinfo,v 1.1 2022/04/29 13:05:35 wiz Exp $
|
||||
|
||||
BLAKE2s (ephemeral_port_reserve-1.1.4.tar.gz) = 8f6af493ce79d9655a2a1eac52b026c977f868708f34110a88e83e3693cb070f
|
||||
SHA512 (ephemeral_port_reserve-1.1.4.tar.gz) = 7a406d092ddaeca28e55a6e0a367f10f21b635e3c32571b304453b86df0a852fb91a9b12619f300833ee58d6ef5aafcd7338801eeb7d330ad43c4f2caa14d50f
|
||||
Size (ephemeral_port_reserve-1.1.4.tar.gz) = 3541 bytes
|
Loading…
Reference in a new issue