summaryrefslogtreecommitdiff
path: root/src/libcamera/include
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2019-07-02 00:58:53 +0300
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2019-07-02 02:37:18 +0300
commitf137451817f47c0bfe59586afe5af7b51f8ccad4 (patch)
tree4fa3220f1a67a506c132bd308bcf97b66ef39e2b /src/libcamera/include
parenta00fdabacdd093c3eccb3d44155e151f59d783bf (diff)
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>
Diffstat (limited to 'src/libcamera/include')
-rw-r--r--src/libcamera/include/ipc_unixsocket.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/libcamera/include/ipc_unixsocket.h b/src/libcamera/include/ipc_unixsocket.h
index ef166d74..03e9fe49 100644
--- a/src/libcamera/include/ipc_unixsocket.h
+++ b/src/libcamera/include/ipc_unixsocket.h
@@ -49,6 +49,8 @@ private:
void dataNotifier(EventNotifier *notifier);
int fd_;
+ bool headerReceived_;
+ struct Header header_;
EventNotifier *notifier_;
};