python / cpython

The Python programming language
https://www.python.org
Other
63.73k stars 30.53k forks source link

Add `RDS_CMSG_RXPATH_LATENCY` to `socket` #127383

Open rruuaanng opened 22 hours ago

rruuaanng commented 22 hours ago

Feature or enhancement

Proposal:

This issue suggests adding new RDS constants.

s = /* a RDS type socket */
msg, ancdata, flags, addr = s.recvmsg(2048, socket.CMSG_LEN(5 * 128))
for cmsg_level, cmsg_type, cmsg_data in ancdata:
    if cmsg_type == RDS_CMSG_RXPATH_LATENCY:
        # some processing

It‘s used to query the rx-path(that's receive) latency of RDS. Usually used to optimize RDS communication, such as controlling the number of connections and other strategies

Has this already been discussed elsewhere?

No response given

Links to previous discussion of this feature:

No response

Linked PRs

erlend-aasland commented 16 hours ago

This issue suggests adding new RDS constants.

Both the devguide and the issue template instructs you to explain what you are proposing and why you are proposing it. The sentence above does neither of those. Yes, I know this is a trivial issue, but that's no excuse for dismissing our workflow.

Why are you proposing to add RDS_CMSG_RXPATH_LATENCY? What does it do?

erlend-aasland commented 16 hours ago

Why are you proposing to add RDS_CMSG_RXPATH_LATENCY? What does it do?

Ask yourself these questions every time you propose a new feature, even if it is just a flag to some syscall wrapper.

rruuaanng commented 13 hours ago

Thank you for your guidance, I'll do better next time. I modified it and added the description of another PR. (I think hackers should be familiar with linux, maybe I don't need to explain it too much.)

erlend-aasland commented 12 hours ago

I modified it and added the description of another PR.

RDS_CMSG_RXPATH_LATENCY is not an ioctl constant. The description you added does not make sense.

(I think hackers should be familiar with linux, maybe I don't need to explain it too much.)

Read again what I already explained: https://github.com/python/cpython/issues/127383#issuecomment-2507355807

erlend-aasland commented 12 hours ago

Please explain how the constant can be used from a Python perspective using the socket API.

rruuaanng commented 12 hours ago

I changed the example to a Python-like form, which seems to be more expressive and more suitable for the Python community. (I admit this is better than my method.)