-
Notifications
You must be signed in to change notification settings - Fork 17
[Feat] Change to unix domain socket #52
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
Open
RandyLambert
wants to merge
10
commits into
chaos-mesh:master
Choose a base branch
from
RandyLambert:change-to-unix-domain-socket
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 6 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
ccc5cfc
[Feat] Change to unix domain socket
RandyLambert 4f5d9bb
[Fix] Delete serve_interactive return error
RandyLambert 7d4795f
[Feat] Use unix domain socket with path
RandyLambert 26df9e2
[Feat] Use unix domain socket with path
RandyLambert f0c5434
[Feat] Use unix domain socket with path
RandyLambert 492d386
[Feat] Use unix domain socket with path
RandyLambert 6cde853
[Feat] Use unix domain socket with path
RandyLambert 8321a2e
[Feat] Use unix domain socket with path
RandyLambert 22bc2ce
[Feat] Use unix domain socket with path
RandyLambert 1128034
Merge branch 'master' into change-to-unix-domain-socket
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,30 @@ | ||
use futures::future::select_all; | ||
use tokio::signal::unix::{signal, Signal, SignalKind}; | ||
use std::path::PathBuf; | ||
|
||
pub struct Signals(Vec<Signal>); | ||
pub struct Signals | ||
{ | ||
pub signals :Vec<Signal>, | ||
interactive_path: PathBuf, | ||
} | ||
|
||
impl Signals { | ||
pub fn from_kinds<'a>( | ||
kinds: impl 'a + IntoIterator<Item = &'a SignalKind>, | ||
interactive_path: PathBuf, | ||
) -> anyhow::Result<Self> { | ||
let signals = kinds | ||
.into_iter() | ||
.map(|kind| signal(*kind)) | ||
.collect::<Result<Vec<_>, _>>()?; | ||
Ok(Self(signals)) | ||
Ok(Signals{signals, interactive_path}) | ||
} | ||
|
||
pub async fn wait(&mut self) -> anyhow::Result<()> { | ||
select_all(self.0.iter_mut().map(|sig| Box::pin(sig.recv()))).await; | ||
select_all(self.signals.iter_mut().map(|sig| Box::pin(sig.recv()))).await; | ||
if self.interactive_path != PathBuf::new() { | ||
std::fs::remove_file(self.interactive_path.clone())?; | ||
} | ||
Ok(()) | ||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.