Skip to content

Fix: mdsconnect incorrectly aborts on the first connection#2535

Closed
WhoBrokeTheBuild wants to merge 1 commit intoMDSplus:alphafrom
WhoBrokeTheBuild:slw-fix-mdsconnect-abort
Closed

Fix: mdsconnect incorrectly aborts on the first connection#2535
WhoBrokeTheBuild wants to merge 1 commit intoMDSplus:alphafrom
WhoBrokeTheBuild:slw-fix-mdsconnect-abort

Conversation

@WhoBrokeTheBuild
Copy link
Member

Somewhere along the line TdiShrExt->rMdsConnect started returning the connection number (starting at 0) instead of a status code.
So on an error, it actually returns -1, not 0.
If mdsconnect is called with _abort set, then it will abort() on the first connection (_status == 0).

@WhoBrokeTheBuild WhoBrokeTheBuild added the bug An unexpected problem or unintended behavior label Feb 16, 2023
@WhoBrokeTheBuild WhoBrokeTheBuild self-assigned this Feb 16, 2023
@WhoBrokeTheBuild
Copy link
Member Author

Retest this please

@WhoBrokeTheBuild WhoBrokeTheBuild force-pushed the slw-fix-mdsconnect-abort branch from 7e34a51 to eb0e16d Compare April 6, 2023 19:34
Somewhere along the line TdiShrExt->rMdsConnect started returning the connection number (starting at 0) instead of a status code.
On an error, it actually returns -1, not 0.
If mdsconnect is called with _abort set, then it will abort() on the first connection.
@joshStillerman joshStillerman force-pushed the slw-fix-mdsconnect-abort branch from eb0e16d to 953bda0 Compare May 2, 2023 18:19
@mwinkel-dev
Copy link
Contributor

This is a duplicate of PR #2889 (merged to "alpha" on 25-Mar-2025).

Here is background on the root cause . . .

PR #2288 changed the definition of INVALID_CONNECTION_ID to -1 (it used to be zero). This change was made in mdstcpip/mdsip_connections.h on 19-May-2021. (The reason for the change is unknown, but perhaps there were inconsistent hardcoded definitions scattered throughout the source code.). Because the PR involved hundreds of files, the impact of this redefinition of INVALID_CONNECTION_ID was overlooked.

@mwinkel-dev mwinkel-dev added the duplicate There exists similar issues, pull requests, or discussions label May 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug An unexpected problem or unintended behavior duplicate There exists similar issues, pull requests, or discussions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants