mirror of
https://github.com/9001/copyparty.git
synced 2025-08-17 09:02:15 -06:00
workaround another linux kernel bug
This commit is contained in:
parent
b4c503657b
commit
010770684d
|
@ -1,6 +1,7 @@
|
||||||
# coding: utf-8
|
# coding: utf-8
|
||||||
from __future__ import print_function, unicode_literals
|
from __future__ import print_function, unicode_literals
|
||||||
|
|
||||||
|
import errno
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import socket
|
import socket
|
||||||
|
@ -223,6 +224,11 @@ class TcpSrv(object):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
srv.bind((ip, port))
|
srv.bind((ip, port))
|
||||||
|
sport = srv.getsockname()[1]
|
||||||
|
if port != sport:
|
||||||
|
# linux 6.0.16 lets you bind a port which is in use
|
||||||
|
# except it just gives you a random port instead
|
||||||
|
raise OSError(errno.EADDRINUSE, "")
|
||||||
self.srv.append(srv)
|
self.srv.append(srv)
|
||||||
except (OSError, socket.error) as ex:
|
except (OSError, socket.error) as ex:
|
||||||
if ex.errno in E_ADDR_IN_USE:
|
if ex.errno in E_ADDR_IN_USE:
|
||||||
|
|
Loading…
Reference in a new issue