Let the session own its bind state, written by bound() alone
Mirror / push (push) Successful in 7s
Test / lint (pull_request) Successful in 26s
Test / test (18) (pull_request) Successful in 32s
Test / test (20) (pull_request) Successful in 40s
Test / test (22) (pull_request) Successful in 31s
Test / test (24) (pull_request) Successful in 37s
Test / test (26) (pull_request) Successful in 38s

This commit is contained in:
2026-09-28 03:55:40 +02:00
parent ebc5db5a00
commit b70f0d6ade
8 changed files with 62 additions and 42 deletions
+2 -8
View File
@@ -8,7 +8,7 @@ export type { BindType };
import { ReconnectLoop } from './reconnect-loop.ts';
import { Session } from './session.ts';
import { checkSessionOptions, undeclaredInterfaceVersion } from './session-options.ts';
import { checkSessionOptions } from './session-options.ts';
import { connect as netConnect } from 'node:net';
import { connect as tlsConnect } from 'node:tls';
import { defaultInterfaceVersion } from './defs/constants.ts';
@@ -174,13 +174,7 @@ async function bind(session: Session, options: ClientOptions): Promise<VoidResul
return { err: new Error(`Remote host refused login: ${sent.pduObj.cmdStatus ?? 'unknown'}`) };
}
const declared = sent.pduObj.tlvs.sc_interface_version?.tagValue;
session.boundAs = bindType;
session.loggedIn = true;
session.peerInterfaceVersion = typeof declared === 'number'
? declared
: undeclaredInterfaceVersion;
session.bound(bindType, sent.pduObj.tlvs.sc_interface_version?.tagValue);
session.log.info('client - bound', { bindType, systemId });
return {};