def get_arwsocks(vals):
# asocks is all extant sockets
socknames = ['cmdsock', 'stsock']
asocks = [ s for s in [ vals.get(n) for n in socknames ] if s is not None ] + \
[ info[1] for info in vals.setdefault('runinfo', []) ]
# rsocks is all objects that we could select upon
rsocks = [ s for s in asocks
if isinstance(s, socket.SocketType)
or isinstance(s, SSL.Connection)
or (isinstance(s, SocketNB) and s.sock is not None) ]
# wsocks is all rsocks that indicate they want to be written
wsocks = [ s for s in asocks if isinstance(s, SocketNB) and (s.ssl_write or s.want_write) ]
return (asocks, rsocks, wsocks)
###
# make command string
###
评论列表
文章目录