// deliver the message, this method gets called with different exception (definitely not with BGPDocumentedException).
sendMessage(buildErrorNotify(((BGPDocumentedException)e).getError(), ((BGPDocumentedException) e).getData()));
}
- this.registry.removePeerSession(getRemoteIp());
+ if (this.state == State.OPEN_CONFIRM) {
+ this.registry.removePeerSession(getRemoteIp());
+ }
negotiationFailedCloseChannel(e);
this.state = State.FINISHED;
}
private final Map<TablesKey, AdjRibOutListener> adjRibOutListenerSet = new HashMap();
private final RpcProviderRegistry rpcRegistry;
private RoutedRpcRegistration<BgpPeerRpcService> rpcRegistration;
+ private final PeerRole peerRole;
public BGPPeer(final String name, final RIB rib, final PeerRole role, final RpcProviderRegistry rpcRegistry) {
+ this.peerRole = role;
this.rib = Preconditions.checkNotNull(rib);
this.name = name;
this.chain = rib.createPeerChain(this);
@Override
public void onTransactionChainFailed(final TransactionChain<?, ?> chain, final AsyncTransaction<?, ?> transaction, final Throwable cause) {
LOG.error("Transaction chain failed.", cause);
- releaseConnection();
this.chain.close();
this.chain = this.rib.createPeerChain(this);
+ this.ribWriter = AdjRibInWriter.create(this.rib.getYangRibId(), this.peerRole, this.chain);
+ releaseConnection();
}
@Override