diff --git a/src/modules/module-protocol-native.c b/src/modules/module-protocol-native.c index 9c111866d..cff7049a2 100644 --- a/src/modules/module-protocol-native.c +++ b/src/modules/module-protocol-native.c @@ -578,7 +578,7 @@ static void do_flush_event(void *data, uint64_t count) struct client *impl = data; impl->flush_signaled = false; if (impl->connection) - if (!pw_protocol_native_connection_flush(impl->connection)) + if (pw_protocol_native_connection_flush(impl->connection) < 0) impl->this.disconnect(&impl->this); } diff --git a/src/modules/module-protocol-native/connection.c b/src/modules/module-protocol-native/connection.c index 817e5b56a..ee0a8e287 100644 --- a/src/modules/module-protocol-native/connection.c +++ b/src/modules/module-protocol-native/connection.c @@ -440,13 +440,13 @@ pw_protocol_native_connection_end(struct pw_protocol_native_connection *conn, /** Flush the connection object * * \param conn the connection object - * \return true on success + * \return 0 on success < 0 error code on error * * Write the queued messages on the connection to the socket * * \memberof pw_protocol_native_connection */ -bool pw_protocol_native_connection_flush(struct pw_protocol_native_connection *conn) +int pw_protocol_native_connection_flush(struct pw_protocol_native_connection *conn) { struct impl *impl = SPA_CONTAINER_OF(conn, struct impl, this); ssize_t len; @@ -454,14 +454,14 @@ bool pw_protocol_native_connection_flush(struct pw_protocol_native_connection *c struct iovec iov[1]; struct cmsghdr *cmsg; char cmsgbuf[CMSG_SPACE(MAX_FDS * sizeof(int))]; - int *cm; + int *cm, res = 0; uint32_t i, fds_len; struct buffer *buf; buf = &impl->out; if (buf->buffer_size == 0) - return true; + return 0; fds_len = buf->n_fds * sizeof(int); @@ -502,24 +502,25 @@ bool pw_protocol_native_connection_flush(struct pw_protocol_native_connection *c buf->buffer_size -= len; buf->n_fds = 0; - return true; + return 0; /* ERRORS */ send_error: + res = -errno; pw_log_error("could not sendmsg: %s", strerror(errno)); - return false; + return res; } /** Clear the connection object * * \param conn the connection object - * \return true on success + * \return 0 on success * * Remove all queued messages from \a conn * * \memberof pw_protocol_native_connection */ -bool pw_protocol_native_connection_clear(struct pw_protocol_native_connection *conn) +int pw_protocol_native_connection_clear(struct pw_protocol_native_connection *conn) { struct impl *impl = SPA_CONTAINER_OF(conn, struct impl, this); @@ -527,5 +528,5 @@ bool pw_protocol_native_connection_clear(struct pw_protocol_native_connection *c clear_buffer(&impl->in); impl->in.update = true; - return true; + return 0; } diff --git a/src/modules/module-protocol-native/connection.h b/src/modules/module-protocol-native/connection.h index eed6bc56a..fe9a78368 100644 --- a/src/modules/module-protocol-native/connection.h +++ b/src/modules/module-protocol-native/connection.h @@ -87,10 +87,10 @@ void pw_protocol_native_connection_end(struct pw_protocol_native_connection *conn, struct spa_pod_builder *builder); -bool +int pw_protocol_native_connection_flush(struct pw_protocol_native_connection *conn); -bool +int pw_protocol_native_connection_clear(struct pw_protocol_native_connection *conn); #ifdef __cplusplus