X-Git-Url: http://git.sameswireless.fr/l2tpns.git/blobdiff_plain/ce928583b47102056e28201bd677f4813fada3c6..4df24fd868177859ddd778f1f45bc825f6264cfb:/cluster.c diff --git a/cluster.c b/cluster.c index b54ae0c..67d8d5e 100644 --- a/cluster.c +++ b/cluster.c @@ -1002,6 +1002,36 @@ static int type_changed(int type, int id) return 1; } +// The deleted session, must be before the new session +int cluster_listinvert_session(int sidnew, int sidtodel) +{ + int i, inew = 0; + + for (i = 0 ; i < config->cluster_num_changes ; ++i) + { + if ( cluster_changes[i].id == sidtodel && cluster_changes[i].type == C_CSESSION) + return 0; // Deleted session already before the new session. + + if ( cluster_changes[i].id == sidnew && cluster_changes[i].type == C_CSESSION) + { + inew = i; + break; + } + } + + for ( ; i < config->cluster_num_changes ; ++i) + { + if ( cluster_changes[i].id == sidtodel && cluster_changes[i].type == C_CSESSION) + { + // Reverse position + cluster_changes[i].id = sidnew; + cluster_changes[inew].id = sidtodel; + return 1; + } + } + + return 0; +} // A particular session has been changed! int cluster_send_session(int sid)