Skip to content

Commit c9375dc

Browse files
author
jczic
committed
Update XAsyncSockets lib
1 parent 68a7ac5 commit c9375dc

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

MicroWebSrv2/libs/XAsyncSockets.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def _decThreadsCount(self) :
5353

5454
def _addSocket(self, socket, asyncSocket) :
5555
if socket :
56-
socketno = socket.fileno()
56+
socketno = id(socket)
5757
self._opLock.acquire()
5858
ok = (socketno not in self._asyncSockets)
5959
if ok :
@@ -66,7 +66,7 @@ def _addSocket(self, socket, asyncSocket) :
6666

6767
def _removeSocket(self, socket) :
6868
if socket :
69-
socketno = socket.fileno()
69+
socketno = id(socket)
7070
self._opLock.acquire()
7171
ok = (socketno in self._asyncSockets)
7272
if ok :
@@ -83,7 +83,7 @@ def _removeSocket(self, socket) :
8383

8484
def _socketListAdd(self, socket, socketsList) :
8585
self._opLock.acquire()
86-
ok = (socket.fileno() in self._asyncSockets and socket not in socketsList)
86+
ok = (id(socket) in self._asyncSockets and socket not in socketsList)
8787
if ok :
8888
socketsList.append(socket)
8989
self._opLock.release()
@@ -93,7 +93,7 @@ def _socketListAdd(self, socket, socketsList) :
9393

9494
def _socketListRemove(self, socket, socketsList) :
9595
self._opLock.acquire()
96-
ok = (socket.fileno() in self._asyncSockets and socket in socketsList)
96+
ok = (id(socket) in self._asyncSockets and socket in socketsList)
9797
if ok :
9898
socketsList.remove(socket)
9999
self._opLock.release()
@@ -121,7 +121,7 @@ def _processWaitEvents(self) :
121121
break
122122
for socketsList in ex, wr, rd :
123123
for socket in socketsList :
124-
asyncSocket = self._asyncSockets.get(socket.fileno(), None)
124+
asyncSocket = self._asyncSockets.get(id(socket), None)
125125
if asyncSocket and self._socketListAdd(socket, self._handlingList) :
126126
if socketsList is ex :
127127
asyncSocket.OnExceptionalCondition()
@@ -335,7 +335,7 @@ def OnExceptionalCondition(self) :
335335

336336
@property
337337
def SocketID(self) :
338-
return self._socket.fileno() if self._socket else None
338+
return id(self._socket) if self._socket else None
339339

340340
@property
341341
def ExpireTimeSec(self) :

0 commit comments

Comments
 (0)