BGPError.CEASE);
// Session reestablished with lower source bgp id, dropping current
- } else if (previousConnection.isHigherDirection(currentConnection)) {
+ } else if (previousConnection.isHigherDirection(currentConnection) ||
+ previousConnection.hasHigherAsNumber(currentConnection)) {
LOG.warn("BGP session with {} {} has to be dropped. Opposite session already present", ip, currentConnection);
throw new BGPDocumentedException(
String.format("BGP session with %s initiated %s has to be dropped. Opposite session already present",
BGPError.CEASE);
// Session reestablished with higher source bgp id, dropping previous
- } else if (currentConnection.isHigherDirection(previousConnection)) {
+ } else if (currentConnection.isHigherDirection(previousConnection) ||
+ currentConnection.hasHigherAsNumber(previousConnection)) {
LOG.warn("BGP session with {} {} released. Replaced by opposite session", ip, previousConnection);
this.peers.get(ip).releaseConnection();
return this.peers.get(ip);
-
- } else if (previousConnection.hasHigherAsNumber(currentConnection)) {
- LOG.warn("BGP session with {} {} has to be dropped. Opposite session already present", ip, currentConnection);
- throw new BGPDocumentedException(
- String.format("BGP session with %s initiated %s has to be dropped. Opposite session already present",
- ip, currentConnection),
- BGPError.CEASE);
- } else if (currentConnection.hasHigherAsNumber(previousConnection)) {
- LOG.warn("BGP session with {} {} released. Replaced by opposite session", ip, previousConnection);
- this.peers.get(ip).releaseConnection();
- return this.peers.get(ip);
- // Session reestablished with same source bgp id, dropping current as duplicate
+ // Session reestablished with same source bgp id, dropping current as duplicate
} else {
LOG.warn("BGP session with %s initiated from %s to %s has to be dropped. Same session already present", ip, sourceId, remoteId);
throw new BGPDocumentedException(