in packages/dubbo-node/src/http2-session-manager.ts [260:305]
private setState(
this: Http2SessionManager,
state:
| StateClosed
| StateError
| StateConnecting
| StateVerifying
| StateReady
): void {
this.s.onExitState?.();
switch (state.t) {
case "connecting":
state.conn.then(
(value) => {
this.setState(ready(value, this.options));
},
(reason) => {
this.setState(closedOrError(reason));
}
);
break;
case "verifying":
state.verified.then(
(value) => {
if ("t" in value) {
this.setState(value);
} else {
this.setState(ready(value, this.options));
}
},
(reason) => {
this.setState(closedOrError(reason));
}
);
break;
case "ready":
state.onClose = () => this.setState(closed());
state.onError = (err) => this.setState(closedOrError(err));
break;
case "closed":
break;
case "error":
break;
}
this.s = state;
}