Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
R
re6stnet
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Yohann D'Anello
re6stnet
Commits
004aa1f0
Commit
004aa1f0
authored
Jul 06, 2012
by
Ulysse Beaugnon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
The dead connections are now detected and removed
parent
1f36db14
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
1 deletion
+10
-1
main.py
main.py
+10
-1
No files found.
main.py
View file @
004aa1f0
...
...
@@ -103,11 +103,20 @@ def killConnection(id):
log_message
(
"Can't kill connection to "
+
peer
+
": uncaught error"
,
1
)
pass
def
checkConnections
():
for
id
in
connection_dict
:
p
,
iface
=
connection_dict
[
id
]
if
p
.
poll
()
!=
None
:
log_message
(
'Connection with '
+
str
(
id
)
+
' has failed'
,
3
)
free_interface_set
.
add
(
iface
)
log_message
(
'Updating peers database'
,
5
)
peer_db
.
execute
(
"UPDATE peers SET used = 0 WHERE id = ?"
,
(
id
,))
def
refreshConnections
():
checkConnections
()
# Kill some random connections
try
:
for
i
in
range
(
0
,
int
(
config
.
refresh_count
)):
for
i
in
range
(
0
,
max
(
0
,
len
(
connection_dict
)
-
config
.
client_count
+
config
.
refresh_count
)):
id
=
random
.
choice
(
connection_dict
.
keys
())
killConnection
(
id
)
except
Exception
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment