- this.channel.eventLoop().schedule(new Runnable() {
- @Override
- public void run() {
- if (AbstractBGPSessionNegotiator.this.state != State.FINISHED) {
- AbstractBGPSessionNegotiator.this.sendMessage(buildErrorNotify(BGPError.HOLD_TIMER_EXPIRED));
- negotiationFailed(new BGPDocumentedException("HoldTimer expired", BGPError.FSM_ERROR));
- AbstractBGPSessionNegotiator.this.state = State.FINISHED;
+ int as = preferences.getMyAs().getValue().intValue();
+ // Set as AS_TRANS if the value is bigger than 2B
+ if (as > Values.UNSIGNED_SHORT_MAX_VALUE) {
+ as = AS_TRANS;
+ }
+ sendMessage(new OpenBuilder().setMyAsNumber(as).setHoldTimer(preferences.getHoldTime()).setBgpIdentifier(
+ preferences.getBgpId()).setBgpParameters(preferences.getParams()).build());
+ if (this.state != State.FINISHED) {
+ this.state = State.OPEN_SENT;
+ this.pending = this.channel.eventLoop().schedule(() -> {
+ synchronized (AbstractBGPSessionNegotiator.this) {
+ AbstractBGPSessionNegotiator.this.pending = null;
+ if (AbstractBGPSessionNegotiator.this.state != State.FINISHED) {
+ AbstractBGPSessionNegotiator.this
+ .sendMessage(buildErrorNotify(BGPError.HOLD_TIMER_EXPIRED));
+ negotiationFailed(new BGPDocumentedException("HoldTimer expired", BGPError.FSM_ERROR));
+ AbstractBGPSessionNegotiator.this.state = State.FINISHED;
+ }