Skip to content
Snippets Groups Projects

chg: replace mercurial.util.recvfds() by simpler pure Python implementation

Merged Manuel Jacob requested to merge topic/default/simple_recvfds into branch/default
  1. Jun 02, 2022
    • Manuel Jacob's avatar
      chg: replace mercurial.util.recvfds() by simpler pure Python implementation · c6a3243567b6
      Manuel Jacob authored
      On Python 3, we have socket.socket.recvmsg(). This makes it possible to receive
      FDs in pure Python code. The new code behaves like the previous
      implementations, except that it’s more strict about the format of the ancillary
      data. This works because we know in which format the FDs are passed.
      
      Because the code is (and always has been) specific to chg (payload is 1 byte,
      number of passed FDs is limited) and we now have only one implementation and
      the code is very short, I decided to stop exposing a function in
      mercurial.util.
      
      Note on terminology: The SCM_RIGHTS mechanism is used to share open file
      descriptions to another process over a socket. The sending side passes an array
      of file descriptors and the receiving side receives an array of file
      descriptors. The file descriptors are different in general on both sides but
      refer to the same open file descriptions. The two terms are often conflated,
      even in the official documentation. That’s why I used “FD” above, which could
      mean both “file descriptor” and “file description”.
      c6a3243567b6
Loading