Skip to content

[Bugfix] Peripheral connection event delay/missing disconnect event#1082

Open
h2zero wants to merge 1 commit intomasterfrom
bugfix/peripheral-connect-delay
Open

[Bugfix] Peripheral connection event delay/missing disconnect event#1082
h2zero wants to merge 1 commit intomasterfrom
bugfix/peripheral-connect-delay

Conversation

@h2zero
Copy link
Owner

@h2zero h2zero commented Feb 4, 2026

This removes some incorrect upstream changes that would allow a peripheral/server device to recieve events from connected client requests without the application being aware of the connection.

The code was changed from the original mynewt event flow in that the connection event is not sent until a response from a request to read the remote version/features where originally the event was sent before these responses were received.

This reverts this situaton for the peripheral role because when the connection is made in this case it is fully established and there is no need to wait for the responses to the above requests. In addition the delay caused by these was allowing connected peers to interact without the application knowing of the connection, creating unexpoected issues.

One of those issues is the client could disconnect before the peripheral receives a response to the above requests and the changes that were made would prevent the disconnect event from being sent because the connection was not considered established.

Finally, the connection reattempt code was checking for a connection establishment failure when the device was acting as a slave, which is incorrect as that condition cannot happen if the spec is followed. The controller should never send this event to a peripheral device waiting for connection, it should just stay advertsing.

This patch removes all of the unecessary code that was added and reverts the flow to the original mynewt flow for peripheral devices.

This removes some incorrect upstream changes that would allow a peripheral/server device to recieve
events from connected client requests without the application being aware of the connection.

The code was changed from the original mynewt event flow in that the connection event
is not sent until a response from a request to read the remote version/features where originally
the event was sent before these responses were received.

This reverts this situaton for the peripheral role because when the connection is made in this case
it is fully established and there is no need to wait for the responses to the above requests.
In addition the delay caused by these was allowing connected peers to interact without the application
knowing of the connection, creating unexpoected issues.

One of those issues is the client could disconnect before the peripheral receives a response to the
above requests and the changes that were made would prevent the disconnect event from being sent because
the connection was not considered established.

Finally, the connection reattempt code was checking for a connection establishment failure when the device was
acting as a slave, which is incorrect as that condition cannot happen if the spec is followed. The controller
should never send this event to a peripheral device waiting for connection, it should just stay advertsing.

This patch removes all of the unecessary code that was added and reverts the flow to the original mynewt flow for
peripheral devices.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant