• D
    Fix sending/receiving of FDs when stream returns EAGAIN · b2c62316
    Daniel P. Berrange 提交于
    The code calling sendfd/recvfd was mistakenly assuming those
    calls would never block. They can in fact return EAGAIN and
    this is causing us to drop the client connection when blocking
    ocurrs while sending/receiving FDs.
    
    Fixing this is a little hairy on the incoming side, since at
    the point where we see the EAGAIN, we already thought we had
    finished receiving all data for the packet. So we play a little
    trick to reset bufferOffset again and go back into polling for
    more data.
    
    * src/rpc/virnetsocket.c, src/rpc/virnetsocket.h: Update
      virNetSocketSendFD/RecvFD to return 0 on EAGAIN, or 1
      on success
    * src/rpc/virnetclient.c: Move decoding of header & fds
      out of virNetClientCallDispatch and into virNetClientIOHandleInput.
      Handling blocking when sending/receiving FDs
    * src/rpc/virnetmessage.h: Add a 'donefds' field to track
      how many FDs we've sent / received
    * src/rpc/virnetserverclient.c: Handling blocking when
      sending/receiving FDs
    b2c62316
virnetserverclient.c 30.0 KB