mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 17:33:54 +00:00
Cleanup pubchannel polling
zmq poller returns either zmq socket objects of raw FDs. adding an API in the clients to differentiate
This commit is contained in:
parent
5731a01209
commit
11195c4f2c
@ -1591,7 +1591,7 @@ class Minion(MinionBase):
|
|||||||
self._process_beacons()
|
self._process_beacons()
|
||||||
# TODO: rename?? Maybe do_pub_recv and take a list of them?
|
# TODO: rename?? Maybe do_pub_recv and take a list of them?
|
||||||
# for some reason, native FDs sometimes return event 5, whatever that is...
|
# for some reason, native FDs sometimes return event 5, whatever that is...
|
||||||
if socks.get(self.pub_channel.socket.fileno()):
|
if socks.get(self.pub_channel.poll_key):
|
||||||
print ('got stuff from pub_channel')
|
print ('got stuff from pub_channel')
|
||||||
self._do_socket_recv()
|
self._do_socket_recv()
|
||||||
|
|
||||||
|
@ -104,4 +104,11 @@ class PubChannel(object):
|
|||||||
'''
|
'''
|
||||||
raise NotImplementedError()
|
raise NotImplementedError()
|
||||||
|
|
||||||
|
@property
|
||||||
|
def poll_key(self):
|
||||||
|
'''
|
||||||
|
Return the representation that the poller will return
|
||||||
|
'''
|
||||||
|
raise NotImplementedError()
|
||||||
|
|
||||||
# EOF
|
# EOF
|
||||||
|
@ -109,9 +109,6 @@ class PubServerChannel(object):
|
|||||||
elif 'transport' in opts.get('pillar', {}).get('master', {}):
|
elif 'transport' in opts.get('pillar', {}).get('master', {}):
|
||||||
ttype = opts['pillar']['master']['transport']
|
ttype = opts['pillar']['master']['transport']
|
||||||
|
|
||||||
# TODO: remove
|
|
||||||
ttype = 'tcp'
|
|
||||||
|
|
||||||
# switch on available ttypes
|
# switch on available ttypes
|
||||||
if ttype == 'zeromq':
|
if ttype == 'zeromq':
|
||||||
import salt.transport.zeromq
|
import salt.transport.zeromq
|
||||||
|
@ -94,6 +94,10 @@ class TCPPubChannel(salt.transport.client.PubChannel):
|
|||||||
def socket(self):
|
def socket(self):
|
||||||
return self._socket
|
return self._socket
|
||||||
|
|
||||||
|
@property
|
||||||
|
def poll_key(self):
|
||||||
|
return self._socket.fileno()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def master_pub(self):
|
def master_pub(self):
|
||||||
'''
|
'''
|
||||||
|
@ -282,6 +282,10 @@ class ZeroMQPubChannel(salt.transport.client.PubChannel):
|
|||||||
def socket(self):
|
def socket(self):
|
||||||
return self._socket
|
return self._socket
|
||||||
|
|
||||||
|
@property
|
||||||
|
def poll_key(self):
|
||||||
|
return self.socket
|
||||||
|
|
||||||
|
|
||||||
class ZeroMQReqServerChannel(salt.transport.server.ReqServerChannel):
|
class ZeroMQReqServerChannel(salt.transport.server.ReqServerChannel):
|
||||||
def zmq_device(self):
|
def zmq_device(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user