https://issues.apache.org/jira/browse/AMQ-5379 - use zero prefetch if consumer credit is unknown when connecting

This commit is contained in:
Dejan Bosanac 2014-12-04 12:32:50 +01:00
parent 7bafa7da50
commit 5d77b395f6
1 changed files with 3 additions and 3 deletions

View File

@ -321,7 +321,7 @@ class AmqpProtocolConverter implements IAmqpProtocolConverter {
protected void processLinkFlow(Link link) throws Exception { protected void processLinkFlow(Link link) throws Exception {
Object context = link.getContext(); Object context = link.getContext();
int credit = link.getRemoteCredit(); int credit = link.getCredit();
if (context instanceof ConsumerContext) { if (context instanceof ConsumerContext) {
ConsumerContext consumerContext = (ConsumerContext)context; ConsumerContext consumerContext = (ConsumerContext)context;
// change consumer prefetch if it's not been already set using // change consumer prefetch if it's not been already set using
@ -1349,9 +1349,9 @@ class AmqpProtocolConverter implements IAmqpProtocolConverter {
consumerInfo.setPrefetchSize(senderCredit); consumerInfo.setPrefetchSize(senderCredit);
consumerContext.consumerPrefetch = senderCredit; consumerContext.consumerPrefetch = senderCredit;
} else { } else {
// set default value for now and change to the consumer's preference // set zero value for now and change to the consumer's preference
// on the first flow packet // on the first flow packet
consumerInfo.setPrefetchSize(AMQPProtocolDiscriminator.DEFAULT_PREFETCH); consumerInfo.setPrefetchSize(0);
} }
} }
consumerContext.credit = senderCredit; consumerContext.credit = senderCredit;