protocol-native: make the connection earlier

Make the connection as soon as we create the client. We create it
without file descriptor and then set it when we connect. This
makes it possible to use the connection to queue messages before
we connect.
This commit is contained in:
Wim Taymans 2019-12-05 11:43:05 +01:00
parent 8bb1ccf587
commit 0b2e4a18ff
3 changed files with 21 additions and 6 deletions

View file

@ -266,6 +266,12 @@ no_mem:
return NULL;
}
int pw_protocol_native_connection_set_fd(struct pw_protocol_native_connection *conn, int fd)
{
conn->fd = fd;
return 0;
}
/** Destroy a connection
*
* \param conn the connection to destroy

View file

@ -72,6 +72,8 @@ pw_protocol_native_connection_add_listener(struct pw_protocol_native_connection
struct pw_protocol_native_connection *
pw_protocol_native_connection_new(struct pw_core *core, int fd);
int pw_protocol_native_connection_set_fd(struct pw_protocol_native_connection *conn, int fd);
void
pw_protocol_native_connection_destroy(struct pw_protocol_native_connection *conn);