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

OsIpcOneShotServer cleanups #114

Merged
merged 4 commits into from Nov 2, 2016
Merged

Conversation

@antrik
Copy link
Contributor

antrik commented Nov 1, 2016

A pair of cleanups removing unneeded wrappers inside OsIpcOneShotServer; plus a not truly related (apart from touching the same code) minor error handling fix in the inprocess implementation, which I cheated in here to avoid dependant PRs...

Make `OsIpcOneShotServer.accept()` take `mut self` (just like the
`macos` implementation) instead of `&self`, thus avoiding the need for
interior mutability.

Unifying the interface is an extra bonus...
@antrik
Copy link
Contributor Author

antrik commented Nov 1, 2016

As usual, this is not tested on MacOS... Let the CI bots speak :-)

@antrik
Copy link
Contributor Author

antrik commented Nov 1, 2016

Gah, so much for CI bots :-( Can we try that again please?...

@emilio
Copy link
Member

emilio commented Nov 1, 2016

@bors-servo
Copy link
Contributor

bors-servo commented Nov 1, 2016

📌 Commit 6c94c38 has been approved by emilio

@bors-servo
Copy link
Contributor

bors-servo commented Nov 1, 2016

Testing commit 6c94c38 with merge cb94fe8...

bors-servo added a commit that referenced this pull request Nov 1, 2016
OsIpcOneShotServer cleanups

A pair of cleanups removing unneeded wrappers inside `OsIpcOneShotServer`; plus a not truly related (apart from touching the same code) minor error handling fix in the `inprocess` implementation, which I cheated in here to avoid dependant PRs...
@bors-servo
Copy link
Contributor

bors-servo commented Nov 1, 2016

💔 Test failed - status-travis

@emilio
Copy link
Member

emilio commented Nov 1, 2016

No log for the failing build, that sucks :(

@emilio
Copy link
Member

emilio commented Nov 1, 2016

cc @larsbergstrom (read backlog)

@larsbergstrom
Copy link
Contributor

larsbergstrom commented Nov 1, 2016

I clicked restart so we can check it out again. If that doesn't generate a log, we will need to send mail to support@travis-ci.com to get help.

@antrik
Copy link
Contributor Author

antrik commented Nov 1, 2016

@larsbergstrom now suddenly it does show the log for the original CI run alright... Weird, but good enough for me :-)

antrik added 3 commits Nov 1, 2016
This implementation wrapped `OsIpcOneShotServer.receiver` in an
`Option<>` for no reason: between creation in `new()` and removal at the
end of `accept()`, there is no place where the value actually needs to
be unset. The field was only being replaced temporarily with None within
`accept()`, just to be dropped along with the rest of
`OsIpcOneShotServer` a moment later at the end of the method... Since we
have ownership of the value within `accept()`, and no `drop()` is
defined for `OsIpcOneShotServer`, we can just move the `receiver` out
instead.

Note: since we no longer explicitly unset `self.receiver`, there is no
need for `self` to be mutable anymore.
Just like in the other implementations, there is no need to panic here.
Unlike the `inprocess` back-end, this one indeed does need to unset
`OsIpcOneShotServer.receiver` within `accept()`, because this variant of
`OsIpcOneShotServer` has a `drop()` implementation -- so we can't just
move out the `receiver`.

Still, we do not need to explicitly wrap the field in an `Option<>`,
since `OsIpcReceiver` can be unset internally with `consume()` -- which
returns a new `OsIpcReceiver` instance for the port, while unsetting the
original one. This appeases `OsIpcOneShotServer.drop()`, while making
sure `OsIpcReceiver.drop()` won't free the actual port.
@antrik antrik force-pushed the antrik:cleanup-OsIpcOneShotServer branch from 6c94c38 to 5a04257 Nov 1, 2016
@antrik
Copy link
Contributor Author

antrik commented Nov 1, 2016

Different approach for the macos implementation -- let's see how this one fares...

@antrik
Copy link
Contributor Author

antrik commented Nov 1, 2016

Yay!

@pcwalton
Copy link
Collaborator

pcwalton commented Nov 2, 2016

@bors-servo
Copy link
Contributor

bors-servo commented Nov 2, 2016

📌 Commit 5a04257 has been approved by pcwalton

@bors-servo
Copy link
Contributor

bors-servo commented Nov 2, 2016

Testing commit 5a04257 with merge b87af21...

bors-servo added a commit that referenced this pull request Nov 2, 2016
OsIpcOneShotServer cleanups

A pair of cleanups removing unneeded wrappers inside `OsIpcOneShotServer`; plus a not truly related (apart from touching the same code) minor error handling fix in the `inprocess` implementation, which I cheated in here to avoid dependant PRs...
@bors-servo
Copy link
Contributor

bors-servo commented Nov 2, 2016

☀️ Test successful - status-appveyor, status-travis

@bors-servo bors-servo merged commit 5a04257 into servo:master Nov 2, 2016
3 checks passed
3 checks passed
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
homu Test successful
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

5 participants
You can’t perform that action at this time.