-
Notifications
You must be signed in to change notification settings - Fork 4
/
result.py
35 lines (25 loc) · 808 Bytes
/
result.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import time
class Result:
ip = ''
started = 0
firstConnected = 0
success = 0
fails = 0
def __init__(self, ip):
self.ip = ip
self.started = time.asctime(time.localtime(time.time()))
return
def indicateConnected(self):
if firstConnected == 0:
firstConnected = time.asctime(time.localtime(time.time()))
return
def addPingResults(self, success, fails):
self.success = success
self.fails = fails
def produce(self):
print("Peer " + self.ip)
print("Started connection at " + str(self.started))
print("First connected at " + str(self.firstConnected))
print("Ping results: ")
print("\tSucceed: " + str(self.success))
print("\tFailed: " + str(self.fails))