use of org.opendaylight.protocol.bgp.parser.BGPError in project bgpcep by opendaylight.
the class BGPSessionImpl method terminate.
/**
* Closes BGP session from the parent with given reason. A message needs to be sent, but parent doesn't have to be
* modified, because he initiated the closing. (To prevent concurrent modification exception).
*
* @param e BGPDocumentedException
*/
@VisibleForTesting
synchronized void terminate(final BGPDocumentedException e) {
final BGPError error = e.getError();
final byte[] data = e.getData();
final NotifyBuilder builder = new NotifyBuilder().setErrorCode(error.getCode()).setErrorSubcode(error.getSubcode());
if (data != null && data.length != 0) {
builder.setData(data);
}
this.writeAndFlush(builder.build());
notifyTerminationReasonAndCloseWithoutMessage(error.getCode(), error.getSubcode());
}
Aggregations