-
Notifications
You must be signed in to change notification settings - Fork 284
Closed
Description
accept_raw is fine.
This happens because SO_NOSIGPIPE is set for accept.
If this is not a bug, I'd like to know if this is a design decision. Then adding a note on macOS line "use accept_raw for unix socket" will be helpful.
use socket2::{Domain, Socket, Type, SockAddr};
use std::thread;
fn main() {
let path = "/tmp/test.sock";
let _ = std::fs::remove_file(path);
let server = Socket::new(Domain::UNIX, Type::STREAM, None).unwrap();
server.bind(&SockAddr::unix(path).unwrap()).unwrap();
server.listen(1).unwrap();
thread::spawn(move || {
Socket::new(Domain::UNIX, Type::STREAM, None)
.unwrap()
.connect(&SockAddr::unix(path).unwrap())
.unwrap();
});
server.accept().expect("macOS always fail here");
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels