-
Notifications
You must be signed in to change notification settings - Fork 671
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2900 from blockstack/fix/2869
Use mmap on MARF connections
- Loading branch information
Showing
19 changed files
with
838 additions
and
42 deletions.
There are no files selected for viewing
This file contains 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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 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 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 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 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 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 |
---|---|---|
@@ -0,0 +1,46 @@ | ||
use deps::ctrlc::platform; | ||
use std::fmt; | ||
|
||
/// Ctrl-C error. | ||
#[derive(Debug)] | ||
pub enum Error { | ||
/// Ctrl-C signal handler already registered. | ||
MultipleHandlers, | ||
/// Unexpected system error. | ||
System(std::io::Error), | ||
} | ||
|
||
impl Error { | ||
fn describe(&self) -> &str { | ||
match *self { | ||
Error::MultipleHandlers => "Ctrl-C signal handler already registered", | ||
Error::System(_) => "Unexpected system error", | ||
} | ||
} | ||
} | ||
|
||
impl From<platform::Error> for Error { | ||
fn from(e: platform::Error) -> Error { | ||
let system_error = std::io::Error::new(std::io::ErrorKind::Other, e); | ||
Error::System(system_error) | ||
} | ||
} | ||
|
||
impl fmt::Display for Error { | ||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { | ||
write!(f, "Ctrl-C error: {}", self.describe()) | ||
} | ||
} | ||
|
||
impl std::error::Error for Error { | ||
fn description(&self) -> &str { | ||
self.describe() | ||
} | ||
|
||
fn cause(&self) -> Option<&dyn std::error::Error> { | ||
match *self { | ||
Error::System(ref e) => Some(e), | ||
_ => None, | ||
} | ||
} | ||
} |
Oops, something went wrong.