Skip to content

Add a connectionIndex field to RecordedRequest#8866

Merged
swankjesse merged 1 commit into
masterfrom
jwilson.0618.connectionIndex
Jun 19, 2025
Merged

Add a connectionIndex field to RecordedRequest#8866
swankjesse merged 1 commit into
masterfrom
jwilson.0618.connectionIndex

Conversation

@swankjesse

Copy link
Copy Markdown
Collaborator

Also rename 'sequenceNumber' to 'exchangeIndex'.
This may be useful to test features like connection reuse.

Also rename 'sequenceNumber' to 'exchangeIndex'.
This may be useful to test features like connection
reuse.
chunkSizes = chunkSizes,
bodySize = bodySize,
body = Buffer().write(body ?: ByteString.EMPTY),
sequenceNumber = sequenceNumber,

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Still sequenceNumber in the old API)

@Target(AnnotationTarget.FIELD)
@Retention(AnnotationRetention.RUNTIME)
@ExtendWith(StartStopExtension::class)
@ExperimentalOkHttpApi

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sneaking this in


if (sequenceNumber == 0) {
if (nextExchangeIndex == 0) {
logger.warning(

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now it’s possible to derive this information from the public API . . . the connection index of the next call will have skipped one!

sslSocketFactory != null -> {
if (socketPolicy === FailHandshake) {
dispatchBookkeepingRequest(sequenceNumber, raw)
dispatchBookkeepingRequest(connectionIndex, nextExchangeIndex++, raw)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice logical improvement

@swankjesse
swankjesse merged commit 36ed345 into master Jun 19, 2025
22 checks passed
@swankjesse
swankjesse deleted the jwilson.0618.connectionIndex branch June 19, 2025 11:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants