Inconsistent `Transport` API for UDP server
- Dominant language
- Erlang
- Stars
- 215
- Forks
- 86
- Avg merge
- 2d 5h
- Merged PRs (30d)
- 7
Description
I'm trying to use `Transport:controlling_process(Sock, NewPid)` inside process spawned by `esockd:open(..., MFArgs)`, but it fails when using UDP with `badarg`. `Sock` argument is from
https://github.com/emqx/esockd/blob/d0c3edcce18a03beab654eb2654d51335bfd7550/examples/udp/udp_echo_server.erl#L34-L35
It seems that `gen_udp:controlling_process` is not implemented.
https://github.com/emqx/esockd/blob/d0c3edcce18a03beab654eb2654d51335bfd7550/src/esockd_transport.erl#L89-L96
I can't simply use `gen_udp:controlling_process()` as workaround since socket is in a different process (error `current process is not the owner of the socket`)
I think we could fix it by updating the `Pid` assigned to a `Peer` with an exported function.
https://github.com/emqx/esockd/blob/d0c3edcce18a03beab654eb2654d51335bfd7550/src/esockd_udp.erl#L273-L278
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.