def is_connection_dropped(conn):
 sock = getattr(conn, 'sock', False)
 if (not sock):
  return False
 if (not poll):
  if (not select):
   return False
  try:
   return select([sock], [], [], 0.0)[0]
  except SocketError:
   return True
 p = poll()
 p.register(sock, POLLIN)
 for (fno, ev) in p.poll(0.0):
  if (fno == sock.fileno()):
   return True

def is_connection_dropped ( conn ) : sock = getattr ( conn , 'sock' , False ) if ( not sock ) : return False if ( not poll ) : if ( not select ) : return False try : return select ( [ sock ] , [ ] , [ ] , 0.0 ) [ 0 ] except SocketError : return True p = poll ( ) p . register ( sock , POLLIN ) for ( fno , ev ) in p . poll ( 0.0 ) : if ( fno == sock . fileno ( ) ) : return True
returns true if the connection is dropped and should be closed .