Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix epoll spliceTo file descriptor with offset #9369

Merged
merged 1 commit into from Jul 16, 2019

Conversation

njhill
Copy link
Member

@njhill njhill commented Jul 15, 2019

Motivation

The AbstractEpollStreamChannel::spliceTo(FileDescriptor, ...) methods take an offset parameter but this was effectively ignored due to what looks like a typo in the corresponding JNI function impl. Instead it would always use the file's own native offset.

Modification

  • Fix typo in netty_epoll_native_splice0() and offset accounting in AbstractEpollStreamChannel::SpliceFdTask.
  • Modify unit test to include an invocation of the public spliceTo method using non-zero offset.

Result

spliceTo FD methods work as expected when an offset is provided. Note this does change the prior behaviour in that the file's native offset was previously modified but will now be unchanged - we could make a further modification to preserve that though if necessary.

Motivation

The AbstractEpollStreamChannel::spliceTo(FileDescriptor, ...) methods
take an offset parameter but this was effectively ignored due to what
looks like a typo in the corresponding JNI function impl. Instead it
would always use the file's own native offset.

Modification

- Fix typo in netty_epoll_native_splice0() and offset accounting in
AbstractEpollStreamChannel::SpliceFdTask.
- Modify unit test to include an invocation of the public spliceTo
method using non-zero offset.

Result

spliceTo FD methods work as expected when an offset is provided.
@netty-bot
Copy link

Can one of the admins verify this patch?

@normanmaurer
Copy link
Member

@netty-bot test this please

@normanmaurer normanmaurer added this to the 4.1.38.Final milestone Jul 16, 2019
@normanmaurer normanmaurer merged commit 1748352 into netty:4.1 Jul 16, 2019
normanmaurer pushed a commit that referenced this pull request Jul 16, 2019
Motivation

The AbstractEpollStreamChannel::spliceTo(FileDescriptor, ...) methods
take an offset parameter but this was effectively ignored due to what
looks like a typo in the corresponding JNI function impl. Instead it
would always use the file's own native offset.

Modification

- Fix typo in netty_epoll_native_splice0() and offset accounting in
AbstractEpollStreamChannel::SpliceFdTask.
- Modify unit test to include an invocation of the public spliceTo
method using non-zero offset.

Result

spliceTo FD methods work as expected when an offset is provided.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants