powered by Jive Software

Queued requests not being sent until next HTTP keepalive request?

Using XMPPBOSHConnection, if you send more requests than the maxConcurrentRequests, it queues the messages, and the requests aren’t sent until the next time sendQueuedRequests is called. Ordinarily, this doesn’t happen until the next HTTP request is explicitly sent.

This results in a case where, if you queue up, say 3 requests, the first two send just fine, but the third one stays in the queue until sendQueuedRequests occurs again, which takes 20 seconds (the delay for keep-alive requests).

The solution seems to be to just call sendQueuedRequests in the onRequestComplete response handler, which is also responsible for decrementing the requestCount. Is there any problem with doing this? I’m just trying to understand the original authors’ reasoning for not calling sendQueuedRequests more aggressively.

Could you share an example and possibly a patch for the suggested fix?