support jython and graalpy

This commit is contained in:
ed 2023-09-13 23:24:56 +00:00
parent a75a992951
commit 23ca00bba8
2 changed files with 11 additions and 1 deletions

View file

@ -15,6 +15,7 @@ from .util import (
E_ADDR_IN_USE,
E_ADDR_NOT_AVAIL,
E_UNREACH,
IP6ALL,
Netdev,
min_ex,
sunpack,
@ -254,6 +255,9 @@ class TcpSrv(object):
srvs: list[socket.socket] = []
for srv in self.srv:
ip, port = srv.getsockname()[:2]
if ip == IP6ALL:
ip = "::" # jython
try:
srv.listen(self.args.nc)
try:
@ -275,6 +279,8 @@ class TcpSrv(object):
srv.close()
continue
t = "\n\nERROR: could not open listening socket, probably because one of the server ports ({}) is busy on one of the requested interfaces ({}); avoid this issue by specifying a different port (-p 3939) and/or a specific interface to listen on (-i 192.168.56.1)\n"
self.log("tcpsrv", t.format(port, ip), 1)
raise
bound.append((ip, port))

View file

@ -56,6 +56,8 @@ E_ADDR_IN_USE = _ens("EADDRINUSE WSAEADDRINUSE")
E_ACCESS = _ens("EACCES WSAEACCES")
E_UNREACH = _ens("EHOSTUNREACH WSAEHOSTUNREACH ENETUNREACH WSAENETUNREACH")
IP6ALL = "0:0:0:0:0:0:0:0"
try:
import ctypes
@ -66,7 +68,9 @@ except:
try:
HAVE_SQLITE3 = True
import sqlite3 # pylint: disable=unused-import # typechk
import sqlite3
assert hasattr(sqlite3, "connect") # graalpy
except:
HAVE_SQLITE3 = False