mirror of
https://github.com/9001/copyparty.git
synced 2025-08-17 09:02:15 -06:00
slight tweaks before merge
Signed-off-by: ed <s@ocv.me>
This commit is contained in:
parent
f55b938d28
commit
56e3b1e787
|
@ -25,8 +25,8 @@ from .util import (
|
|||
termsize,
|
||||
)
|
||||
|
||||
if True:
|
||||
from typing import Generator, Union
|
||||
if True: # pylint: disable=using-constant-test
|
||||
from typing import Generator, Optional, Union
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from .svchub import SvcHub
|
||||
|
@ -245,7 +245,7 @@ class TcpSrv(object):
|
|||
|
||||
def _listen(self, ip: str, port: int) -> None:
|
||||
uds_perm = uds_gid = -1
|
||||
bound = False
|
||||
bound: Optional[socket.socket] = None
|
||||
tcp = False
|
||||
|
||||
if "unix:" in ip:
|
||||
|
@ -274,10 +274,7 @@ class TcpSrv(object):
|
|||
tcp = True
|
||||
ipv = socket.AF_INET
|
||||
|
||||
if not bound:
|
||||
srv = socket.socket(ipv, socket.SOCK_STREAM)
|
||||
else:
|
||||
srv = bound
|
||||
srv = bound or socket.socket(ipv, socket.SOCK_STREAM)
|
||||
|
||||
if not ANYWIN or self.args.reuseaddr:
|
||||
srv.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
|
||||
|
@ -295,8 +292,11 @@ class TcpSrv(object):
|
|||
if getattr(self.args, "freebind", False):
|
||||
srv.setsockopt(socket.SOL_IP, socket.IP_FREEBIND, 1)
|
||||
|
||||
if bound:
|
||||
self.srv.append(srv)
|
||||
return
|
||||
|
||||
try:
|
||||
if not bound:
|
||||
if tcp:
|
||||
srv.bind((ip, port))
|
||||
else:
|
||||
|
|
Loading…
Reference in a new issue