134 return senderIp in self.__peers |
134 return senderIp in self.__peers |
135 |
135 |
136 if senderIp not in self.__peers: |
136 if senderIp not in self.__peers: |
137 return False |
137 return False |
138 |
138 |
139 for connection in self.__peers[senderIp]: |
139 return any(connection.peerPort() == senderPort |
140 if connection.peerPort() == senderPort: |
140 for connection in self.__peers[senderIp]) |
141 return True |
|
142 |
|
143 return False |
|
144 |
141 |
145 def hasConnections(self): |
142 def hasConnections(self): |
146 """ |
143 """ |
147 Public method to check, if there are any connections established. |
144 Public method to check, if there are any connections established. |
148 |
145 |
149 @return flag indicating the presence of connections (boolean) |
146 @return flag indicating the presence of connections (boolean) |
150 """ |
147 """ |
151 for connectionList in self.__peers.values(): |
148 return any(bool(connectionList) |
152 if connectionList: |
149 for connectionList in self.__peers.values()) |
153 return True |
|
154 |
|
155 return False |
|
156 |
150 |
157 def removeConnection(self, connection): |
151 def removeConnection(self, connection): |
158 """ |
152 """ |
159 Public method to remove a connection. |
153 Public method to remove a connection. |
160 |
154 |