Removed the line 'import socket' and it's running now. Looking at the
preceding lines I guess it's safe to assume it was already imported somewhere.
Code now looks like:
def run(self):
try:
while True:
sock, remote = (yield multitask.accept(self.sock)) #
receive client TCP
if sock == None:
if _debug: print 'rtmp.Server accept(sock) returned
None.'
break
if _debug: print 'connection received from', remote
sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
# make it non-block
def set_keepalive_linux(sock, after_idle_sec=20,
interval_sec=30, max_fails=2):
sock.setsockopt(socket.SOL_SOCKET, socket.SO_KEEPALIVE,
1)
sock.setsockopt(socket.IPPROTO_TCP,
socket.TCP_KEEPIDLE, after_idle_sec)
sock.setsockopt(socket.IPPROTO_TCP,
socket.TCP_KEEPINTVL, interval_sec)
sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_KEEPCNT,
max_fails)
client = Client(sock, self)
except GeneratorExit: pass # terminate
except:
if _debug: print 'rtmp.Server exception ', (sys and
sys.exc_info() or None)
if (self.sock):
try: self.sock.close(); self.sock = None
except: pass
if (self.queue):
yield self.queue.put((None, None))
self.queue = None
#################################################
I don't know if it's actually doing anything, it's a wait and see process
unless you see something wrong with my code insert. I'll follow up if not on how
effective this was so it's helpful to others. Thanks!