mirror of
https://github.com/9001/copyparty.git
synced 2025-11-04 22:03:21 +00:00
workaround another linux kernel bug
This commit is contained in:
@@ -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:
|
||||||
|
|||||||
Reference in New Issue
Block a user