public synchronized void close() {
if (this.state != State.IDLE) {
this.writeAndFlush(new NotifyBuilder().setErrorCode(BGPError.CEASE.getCode()).setErrorSubcode(BGPError.CEASE.getSubcode()).build());
+ this.closeWithoutMessage();
}
- this.closeWithoutMessage();
}
/**
}
private synchronized void closeWithoutMessage() {
+ if (this.state == State.IDLE) {
+ return;
+ }
LOG.info("Closing session: {}", this);
removePeerSession();
this.channel.close().addListener(new ChannelFutureListener() {
return this.channel != null && this.channel.isWritable();
}
- void schedule(final Runnable task) {
- Preconditions.checkState(this.channel != null);
- this.channel.eventLoop().submit(task);
- }
-
- @VisibleForTesting
- protected synchronized void setLastMessageSentAt(final long lastMessageSentAt) {
- this.lastMessageSentAt = lastMessageSentAt;
- }
-
@Override
public synchronized BgpSessionState getBgpSessionState() {
return this.sessionStats.getBgpSessionState();