Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
G
guppy
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Svetlana Tkachenko
guppy
Commits
615abc0f
Commit
615abc0f
authored
12 years ago
by
Svetlana Tkachenko
Browse files
Options
Downloads
Patches
Plain Diff
Added a broken ping_server plugin to extra
parent
1e3cc232
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
extra/ping_server.py
+59
-0
59 additions, 0 deletions
extra/ping_server.py
with
59 additions
and
0 deletions
extra/ping_server.py
0 → 100644
+
59
−
0
View file @
615abc0f
# guppy Copyright (C) 2010-2011 guppy team members.
#
# This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
# This is free software, and you are welcome to redistribute it
# under certain conditions; type `show c' for details.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
# MA 02110-1301, USA.
import
time
import
threading
@plugin
class
Ping_server
(
object
):
def
__init__
(
self
,
server
):
# Variables.
self
.
server
=
server
self
.
network
=
self
.
server
.
config
[
"
network
"
]
self
.
commands
=
[]
self
.
loop
=
True
self
.
ponged
=
False
self
.
timeLoop
=
10
;
def
loop
(
plugin
,
server
):
timeWaited
=
0
while
self
.
loop
:
if
timeWaited
>=
self
.
timeLoop
:
self
.
pingServer
()
timeWaited
=
0
time
.
sleep
(
5
)
timeWaited
+=
5
self
.
t1
=
threading
.
Thread
(
target
=
loop
,
args
=
(
self
,
server
,))
self
.
t1
.
daemon
=
True
self
.
t1
.
start
()
server
.
handle
(
"
data
"
,
self
.
handle_data
)
def
pingServer
(
self
):
self
.
server
.
prnt
(
"
Ponged?
"
+
str
(
self
.
ponged
))
if
(
self
.
ponged
==
False
):
self
.
server
.
pluginManager
.
unloadAllPlugins
()
self
.
server
.
pluginManager
.
event
(
"
disconnect
"
,
self
.
network
)
self
.
server
.
__init__
(
self
.
server
.
config
)
self
.
loop
=
False
self
.
server
.
prnt
(
"
Sending ping...
"
)
self
.
server
.
sendLine
(
'
ping :0000
'
)
self
.
ponged
=
False
self
.
server
.
prnt
(
"
Ping sent.
"
)
def
handle_data
(
self
,
network
,
data
):
self
.
ponged
=
True
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment