aboutsummaryrefslogtreecommitdiffstats
path: root/plugin.py
diff options
context:
space:
mode:
authorkongr45gpen <kongr45gpen@helit.org>2013-07-23 23:12:15 +0300
committerkongr45gpen <kongr45gpen@helit.org>2013-07-23 23:12:15 +0300
commit210fc213c69e4c77334863a4fb068c072dc77c98 (patch)
tree1e2b711653782dda801f4fde9e9077042fa3699c /plugin.py
parentb93a7f819a2cb3fc08b4efd66c808a7922eb320c (diff)
downloadsupybot_github-210fc213c69e4c77334863a4fb068c072dc77c98.tar.gz
supybot_github-210fc213c69e4c77334863a4fb068c072dc77c98.tar.bz2
supybot_github-210fc213c69e4c77334863a4fb068c072dc77c98.zip
Shut the server down when unloading the plugin
Diffstat (limited to 'plugin.py')
-rw-r--r--plugin.py22
1 files changed, 15 insertions, 7 deletions
diff --git a/plugin.py b/plugin.py
index 2a8af85..301b251 100644
--- a/plugin.py
+++ b/plugin.py
@@ -34,25 +34,33 @@ class Github(callbacks.Plugin):
threaded = True
pass
- def ServerStart(meh):
- server_class = BaseHTTPServer.HTTPServer
- httpd = server_class(('', 8093), GithubHandler)
- print time.asctime(), "Server Starts - %s:%s" % ('', 8093)
- httpd.serve_forever()
+ def ServerStart(main,httpd,irc):
+ try:
+ print time.asctime(), "Server Starts - %s:%s" % ('', 8093)
+ httpd.serve_forever()
+ except:
+ return
def __init__(self, irc):
self.__parent = super(Github, self)
self.__parent.__init__(irc)
self.rng = random.Random() # create our rng
self.rng.seed() # automatically seeds with current time
- t = threading.Thread(target=self.ServerStart)
- t.daemon = True
+ server_class = BaseHTTPServer.HTTPServer
+ self.httpd = server_class(('', 8093), GithubHandler)
+ t = threading.Thread(target=self.ServerStart,args=(self.httpd,irc))
+ t.daemon = False
t.start()
def __call__(self, irc, msg):
self.__parent.__call__(irc, msg)
print "I have no idea what is happeninig"
+
+ def die(self):
+ print "OH NOES IM DYING"
+ self.httpd.server_close()
+ self.__parent.die()
def toast(self, irc, msg, args, seed, items):
"""<seed> <item1> [<item2> ...]

© 2014-2024 Faster IT GmbH | imprint | privacy policy