libcamera: ipc: unix: Make socket operation asynchronous
Blocking socket operation when receiving messages may lead to long delays, and possibly a complete deadlock, if the remote side delays sending of the payload after the header, or doesn't send the payload at all. To avoid this, make the socket non-blocking and implement a simple state machine to receive the header synchronously with the socket read notification. The payload read is still synchronous with the receive() method to avoid data copies. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
This commit is contained in:
@@ -49,6 +49,8 @@ private:
|
||||
void dataNotifier(EventNotifier *notifier);
|
||||
|
||||
int fd_;
|
||||
bool headerReceived_;
|
||||
struct Header header_;
|
||||
EventNotifier *notifier_;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user