-
Notifications
You must be signed in to change notification settings - Fork 136
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Support custom ipc paths #8
Conversation
src/cli.rs
Outdated
_ => panic!("Must not supply an ipc path when using http protocol"), | ||
}, | ||
"ipc" => match &http_port.to_string()[..] { | ||
DEFAULT_HTTP_PORT => println!("Protocol: {}", protocol), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be nice to print the IPC path here.
src/jsonrpc.rs
Outdated
// TODO something smarter than just dropping the existing file and/or | ||
// make sure file gets cleaned up on shutdown. | ||
match fs::remove_file(ipc_path) { | ||
Err(_) => panic!("Could not serve IPC from existing path '{}'", ipc_path), | ||
Ok(()) => unix::net::UnixListener::bind(ipc_path).unwrap(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So this approach no longer seems acceptable with a configurable IPC path (just dropping whatever file is found there and replacing it).
The simple answer is that we should just panic instead of trying to remove the file and reattempting. But then to solve the original problem: I think that we were leaking the file on shutdown sometimes. (Maybe anytime there's a panic?)
So the next step is to make sure that the IPC file gets removed when trin shuts down, even after a panic. (Although, it's probably worth verifying the theory. All I really know is that sometimes it used to happen that I had a pre-existing file on startup, and it was annoying. Not sure where it came from).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I updated the code to add some handlers that will clean up the ipc file upon ctrl+c
shutdown and all panics. It works as expected locally, but could use some integration tests to make sure the cleanup happens as expected. I'm leaning towards saving those for a larger integration test pr coming soontm.
I took the liberty of rebasing |
Reminder to rebase on master to get CI tests |
927b3c1
to
be77fed
Compare
17d807c
to
91975de
Compare
91975de
to
eb2c39e
Compare
@carver ping for another 👀. I updated the settings in circle ci to |
Ready for review after #2 is merged
DEFAULT_HTTP_PORT
andDEFAULT_IPC_PATH
to be constants