Navigation


Changeset 1010:357c2f892d24 in freeDiameter for libfdcore/p_psm.c


Ignore:
Timestamp:
Mar 26, 2013, 12:39:32 AM (11 years ago)
Author:
Sebastien Decugis <sdecugis@freediameter.net>
Branch:
default
Phase:
public
Message:

Implement a new counter on pending answers to send back to a peer.
Function fd_peer_get_load_pending updated to retrieve this counter as well.
When a peer has answers pending, the connection is not immediately teared down
upon DPR/DPA exchange, but a GRACE_TIMEOUT delay (default 1 sec) is granted.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libfdcore/p_psm.c

    r975 r1010  
    4545begining and end of a connection lifetime. It means we need agility to
    4646switch between "ordering enforced" and "ordering not enforced to counter
    47 HotLB" modes of operation.
    48 
    49 The connection state machine represented in RFC3588 (and rfc3588bis) is
     47Head of the Line Blocking" modes of operation.
     48
     49The connection state machine represented in RFC3588 (and RFC6733) is
    5050incomplete, because it lacks the SUSPECT state and the 3 DWR/DWA
    5151exchanges (section 5.1) when the peer recovers from this state.
     
    9191application message is lost.
    9292
    93 This situation is actually quite possible because DPR/DPA messages are
     93This situation is actually happening easily because DPR/DPA messages are
    9494very short, while application messages can be quite large. Therefore,
    9595they require much more time to deliver.
     
    9797I really cannot see a way to counter this effect by using the ordering
    9898of the messages, except by applying a timer (state STATE_CLOSING_GRACE).
     99This timer can be also useful when we detect that some messages has not
     100yet received an answer on this link, to give time to the application to
     101complete the exchange ongoing.
    99102
    100103However, this problem must be balanced with the fact that the message
     
    197200        return 0;
    198201}
    199 static int leave_open_state(struct fd_peer * peer)
     202static int leave_open_state(struct fd_peer * peer, int skip_failover)
    200203{
    201204        /* Remove from active peers list */
     
    208211       
    209212        /* Failover the messages */
    210         fd_peer_failover_msg(peer);
     213        if (!skip_failover) {
     214                fd_peer_failover_msg(peer);
     215        }
    211216       
    212217        return 0;
     
    288293       
    289294        if (old == STATE_OPEN) {
    290                 CHECK_FCT( leave_open_state(peer) );
    291         }
    292        
     295                CHECK_FCT( leave_open_state(peer, new_state == STATE_CLOSING_GRACE) );
     296        }
     297        if (old == STATE_CLOSING_GRACE) {
     298                fd_peer_failover_msg(peer);
     299        }
     300
    293301        if (new_state == STATE_OPEN) {
    294302                CHECK_FCT( enter_open_state(peer) );
     
    298306                /* Purge event list */
    299307                fd_psm_events_free(peer);
     308               
     309                /* Reset the counter of pending anwers to send */
     310                peer->p_reqin_count = 0;
    300311               
    301312                /* If the peer is not persistant, we destroy it */
     
    529540                                fd_msg_log( FD_MSG_LOG_TIMING, msg, "Answer received in %d.%06.6d sec.", delay.tv_sec, delay.tv_nsec / 1000 );
    530541                        }
     542                } else {
     543                        /* Mark the incoming request so that we know we have pending answers for this peer */
     544                        CHECK_POSIX_DO( pthread_mutex_lock(&peer->p_state_mtx), goto psm_end  );
     545                        peer->p_reqin_count++;
     546                        CHECK_POSIX_DO( pthread_mutex_unlock(&peer->p_state_mtx), goto psm_end  );
    531547                }
    532548               
Note: See TracChangeset for help on using the changeset viewer.