-
Notifications
You must be signed in to change notification settings - Fork 42
Description
I am trying to create an event source for Unix domain sockets to use in an IPC Server. I tried to follow the zmq example in the book and have a working solution. But I have some design questions. Becasue there are some differences in the event sources between a ZMQ socket and a Unix socket.
With unix sockets the event sources are split into two. The listener that accepts connections. And the UnixStream that sends and receives messages.
Is it better to keep these sources separate or have a composed EventSource like this
pub struct IPCSource {
socket_source: calloop::generic::Generic<calloop::generic::FdWrapper<UnixListener>>,
connections: HashMap<&str, calloop::generic::Generic<calloop::generic::FdWrapper<UnixStream>>>,
}
Writ now I have two separate Event Sources one for the Listener and one for the UnixStream (there will be multiple UnixStreams because of multiple connections).
But I am wondering if I can gain some benefit by composing them like this or something similar?