Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
teeworlds_srvbrowse
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
minus
teeworlds_srvbrowse
Commits
a4c95fe9
Commit
a4c95fe9
authored
Sep 19, 2014
by
minus
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactored servercount example
parent
50562358
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
5 deletions
+11
-5
servercount.py
servercount.py
+11
-5
No files found.
servercount.py
View file @
a4c95fe9
from
teeworlds
import
query_masters_servercount
,
create_masters
,
EventSocket
#!/usr/bin/env python3
from
teeworlds
import
query_masters_servercount
,
create_masters
,
EventSocket
,
MasterServer
class
CountingMasterServer
(
MasterServer
):
total_count
=
0
def
on_count_receive
(
self
,
count
):
CountingMasterServer
.
total_count
+=
count
e
=
EventSocket
()
e
=
EventSocket
()
m
=
create_masters
(
e
)
m
=
create_masters
(
e
,
master_factory
=
CountingMasterServer
)
query_masters_servercount
(
m
)
query_masters_servercount
(
m
)
#for m in t.masterlist:
# m.on_server_add = lambda s: s.request_info()
#t.query_masters()
e
.
run
()
e
.
run
()
print
(
CountingMasterServer
.
total_count
)
\ No newline at end of file
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