/usr/share/pyshared/socketio/storage.py is in python-socketio 0.3.6-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | import gevent
import weakref
try:
import redis
except ImportError:
pass
class RedisStorage(object):
def __init__(self, server, **kwargs):
self.server = weakref.proxy(server)
self.jobs = []
self.host = kwargs.get('host', 'localhost')
self.port = kwargs.get('port', 6379)
r = redis.StrictRedis(host=self.host, port=self.port)
self.conn = r.pubsub()
self.spawn(self.listener)
def listener(self):
for m in self.conn.listen():
print("===============NEW MESSAGE!!!====== %s", m)
def spawn(self, fn, *args, **kwargs):
new = gevent.spawn(fn, *args, **kwargs)
self.jobs.append(new)
return new
def new_request(self, environ):
print("===========NEW REQUEST %s===========" % environ)
|