Skip to content
Snippets Groups Projects
Commit 77656b38 authored by Piotr Maślanka's avatar Piotr Maślanka
Browse files

qosif

parent 153d24da
No related branches found
No related tags found
No related merge requests found
......@@ -40,6 +40,7 @@ class BodyReceiveMode(object):
# these constitute received pieces. this is always ZC
class Consumer(Channeler):
"""
This object represents a consumer in the system.
......@@ -123,12 +124,7 @@ class Consumer(Channeler):
self.attache_group = None # attache group this belongs to.
# if this is not None, then it has an attribute
# on_cancel_customer(Consumer instance)
if qos is not None:
if isinstance(qos, int):
qos = 0, qos
elif qos[0] is None:
qos = 0, qos[1] # prefetch_size=0=undefined
self.qos = qos
self.qos = _qosify(qos)
self.qos_update_sent = False # QoS was not sent to server
self.future_to_notify = future_to_notify
......@@ -410,6 +406,15 @@ class Consumer(Channeler):
self.set_qos(self.qos[0], self.qos[1])
def _qosify(qos):
if qos is not None:
if isinstance(qos, int):
qos = 0, qos
elif qos[0] is None:
qos = 0, qos[1] # prefetch_size=0=undefined
return qos
class MessageReceiver(object):
"""This is an object that is used to received messages.
......
......@@ -34,7 +34,7 @@ UNICO = u"u'%s'"
SPACER = u'''
"""
'''
GET_SIZE_HEADER = u'\n def get_size(self):\n'
def _compile_particular_content_property_list_class(zpf, fields):
"""
......@@ -129,7 +129,7 @@ def _compile_particular_content_property_list_class(zpf, fields):
mod.append(u' return cls(%s)\n' % (FFN, ))
# get_size
mod.append(u'\n def get_size(self):\n')
mod.append(GET_SIZE_HEADER)
mod.append(get_counter(present_fields, prefix=u'self.', indent_level=2)[
:-1]) # skip eol
mod.append(u' + %s\n' % (zpf_length,)) # account for pf length
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment