time_t last_pos; /*!< Last time we told the user their position */
int opos; /*!< Where we started in the queue */
int handled; /*!< Whether our call was handled */
+ int pending; /*!< Non-zero if we are attempting to call a member */
int max_penalty; /*!< Limit the members that can take this call to this penalty or lower */
int linpos; /*!< If using linear strategy, what position are we at? */
int linwrapped; /*!< Is the linpos wrapped? */
ast_debug(1, "There are %d available members.\n", avl);
- while ((idx < avl) && (ch) && (ch != qe)) {
+ while ((idx < avl) && (ch) && !ch->pending && (ch != qe)) {
idx++;
ch = ch->next;
}
else
to = (qe->parent->timeout) ? qe->parent->timeout * 1000 : -1;
orig = to;
+ ++qe->pending;
ring_one(qe, outgoing, &numbusies);
ao2_unlock(qe->parent);
if (use_weight)
ao2_unlock(qe->parent);
peer = lpeer ? lpeer->chan : NULL;
if (!peer) {
+ qe->pending = 0;
if (to) {
/* Must gotten hung up */
res = -1;