[
https://issues.apache.org/jira/browse/THRIFT-5283?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17240702#comment-17240702
]
Max commented on THRIFT-5283:
-----------------------------
Hey [~prateeknischal]
Indeed, I can see the issue now. {{std::net::SocketAddr}} only represents IP
addresses; and the said trait {{std::net::ToSocketAddrs}} can only _resolve to_
IP addresses. The approach I suggested would not work.
The recommended practice seems to be layering another enum which would union
{{std::net::SocketAddr}}, {{std::os::unix::net::SocketAddr}} and whatever else
connection mechanisms needed [potentially in the future], e.g. like is done
here:
[https://github.com/Azure/iot-identity-service/blob/main/http-common/src/connector.rs]
Within Thrift's architecture though, looks like
{{thrift::transport::TIoChannel}} trait has an implementation to be written,
for e.g. {{thrift::transport::TUnixSocketChannel}}.
So all I can say right now — it's not implemented. Bumping up the priority.
> Ability to listen over unix socket in thrift Rust crate
> -------------------------------------------------------
>
> Key: THRIFT-5283
> URL: https://issues.apache.org/jira/browse/THRIFT-5283
> Project: Thrift
> Issue Type: New Feature
> Affects Versions: 0.13.0
> Reporter: Prateek Kumar Nischal
> Priority: Minor
>
> The rust crate for [thrift|https://crates.io/crates/thrift] right now has the
> ability to create a server [but only over a TCP
> socket|https://github.com/apache/thrift/blob/master/lib/rs/src/server/threaded.rs#L172].
> {code}
> pub fn listen<A: ToSocketAddrs>(&mut self, listen_address: A) ->
> thrift::Result<()>
> {code}
> The API requires the trait
> [ToSocketAddrs|https://doc.rust-lang.org/std/net/trait.ToSocketAddrs.html] to
> be implemented which is not possible for a Unix Domain Socket.
> Other libraries, for example, python has an option to serve over unix
> sockets. eg
> {code:python}
> TSocket.TServerSocket(unix_socket='/tmp/service.sock')
> {code}
> It would be really nice to be able to get a similar API in rust as well
> unless there is a way to do it already. Please let me know if it already
> exists.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)