[svn r815] added sockmonitor on gmencoder plugin trunk
authorrenatofilho
Thu Aug 16 15:48:57 2007 +0100 (2007-08-16)
branchtrunk
changeset 809ec0a31edf362
parent 808 215c45290ce3
child 810 fcf0bc36025a
[svn r815] added sockmonitor on gmencoder plugin
gmyth-stream/server/0.3/plugins/transcoders/gmencoder.py
     1.1 --- a/gmyth-stream/server/0.3/plugins/transcoders/gmencoder.py	Thu Aug 16 15:24:01 2007 +0100
     1.2 +++ b/gmyth-stream/server/0.3/plugins/transcoders/gmencoder.py	Thu Aug 16 15:48:57 2007 +0100
     1.3 @@ -77,9 +77,9 @@
     1.4              return False
     1.5  
     1.6          try:
     1.7 -	    #p = select.poll()
     1.8 +	    p = select.poll()
     1.9  	    #print outfd.fileno()
    1.10 -	    #p.register (connection, select.POLLNVAL | select.POLLERR | select.POLLHUP)
    1.11 +	    p.register (outfd, select.POLLNVAL | select.POLLERR | select.POLLHUP | select.POLLIN )
    1.12              while (self.proc and self.proc.poll() == None):
    1.13                  r, w, x = select.select([self.proc.stdout], [], [], 1)
    1.14                  if self.proc.stdout in r:
    1.15 @@ -88,15 +88,12 @@
    1.16                          self.status = progress.split (":")[1]
    1.17  		    elif (progress.find ("Erro") >= 0):
    1.18  			return False
    1.19 -		"""
    1.20 -		try:
    1.21 -		    print connection.getpeername()
    1.22 -		    print connection.getsockname()
    1.23 -		except Esception, e:
    1.24 -		    print "Lost Connection"
    1.25 -		    self.stop ()
    1.26 -		    return False
    1.27 -		"""
    1.28 +
    1.29 +		    ret = p.poll(0)
    1.30 +		    if ret:
    1.31 +		    	print "Lost Connection"
    1.32 +		    	self.stop ()
    1.33 +		    	return False
    1.34  
    1.35          except Exception, e:
    1.36              self.log.error(self.tid, "Problems handling data: %s" % e)