eric7/Cooperation/Connection.py

branch
eric7
changeset 8318
962bce857696
parent 8312
800c432b34c8
child 8356
68ec9c3d4de5
--- a/eric7/Cooperation/Connection.py	Sun May 16 11:43:59 2021 +0200
+++ b/eric7/Cooperation/Connection.py	Sun May 16 20:07:24 2021 +0200
@@ -7,8 +7,8 @@
 Module implementing a class representing a peer connection.
 """
 
-from PyQt5.QtCore import pyqtSignal, QTimer, QTime, QByteArray
-from PyQt5.QtNetwork import QTcpSocket, QHostInfo
+from PyQt6.QtCore import pyqtSignal, QTimer, QTime, QByteArray
+from PyQt6.QtNetwork import QTcpSocket, QHostInfo
 
 from E5Gui import E5MessageBox
 from E5Gui.E5Application import e5App
@@ -235,7 +235,7 @@
                 self.__sendGreetingMessage()
             
             self.__pingTimer.start()
-            self.__pongTime.start()
+            self.__pongTime = QTime.currentTime()
             self.__state = Connection.ReadyForUse
             self.readyForUse.emit()
         
@@ -255,7 +255,7 @@
         """
         Private slot to send a ping message.
         """
-        if self.__pongTime.elapsed() > PongTimeout:
+        if self.__pongTime.msecsTo(QTime.currentTime()) > PongTimeout:
             self.abort()
             return
         
@@ -389,7 +389,7 @@
             self.write(QByteArray("{0}{1}1{1}p".format(
                 Connection.ProtocolPong, SeparatorToken).encode("utf-8")))
         elif self.__currentDataType == Connection.Pong:
-            self.__pongTime.restart()
+            self.__pongTime = QTime.currentTime()
         elif self.__currentDataType == Connection.GetParticipants:
             self.getParticipants.emit()
         elif self.__currentDataType == Connection.Participants:

eric ide

mercurial