Commit graph

863 commits

Author SHA1 Message Date
Wim Taymans
2fd64f1591 connection: dup and close fds
dup the fd when added to the outgoing buffer and close it againç
when sent. This ensures the fd remains valid in the buffer. A
quick add/remove of memory before a buffer flush could close the
fd before we can send it and then we get a bad fd and disconnect
the client.
2020-06-05 17:36:03 +02:00
Wim Taymans
2462cac4f2 add some more debug 2020-06-05 16:44:35 +02:00
Wim Taymans
51ae60b0c4 portal: fix small leak 2020-06-05 15:49:39 +02:00
Wim Taymans
0efadbb297 client-node: free old mem after setting new mem 2020-06-05 13:04:43 +02:00
Wim Taymans
972a790cf2 client-node: send error when node_set_io fails 2020-06-05 13:03:16 +02:00
Wim Taymans
969377b079 client-node: simplify cleanup
Remove the extra proxy to the node, it's awkward and not needed.
pw_core_export() returns a handle to the remote object with the
interface of the factory.

If the node is destroyed, make sure the proxy doesn't access
it anymore.

If the handle is removed or destroyed, make sure we remove the
proxy related info around the node. Never destroy the proxy
ourselves, this is something the app needs to do when it is
ready.
2020-06-05 12:43:26 +02:00
Wim Taymans
8292c556e9 client-node: first set param, then clear buffers
Because setting the param might still access the buffer to do
cleanup.
2020-06-04 10:15:37 +02:00
Wim Taymans
6d0fd7b58c remote-node: run _destroy in the _removed handler 2020-06-03 15:42:45 +02:00
Wim Taymans
4405fe4c14 remote-node: handle deleted client-node 2020-06-03 15:28:28 +02:00
Wim Taymans
b4b7ba4cbb remote-node: suspend node before cleanup
When the proxy is destroyed, suspend the node before we start
removing the memory or else the node might still be using it from
the data thread and crash.
2020-06-03 12:04:01 +02:00
George Kiagiadakis
17d7cdc80e spa-node-factory: cleanup node when binding the client resource fails 2020-06-02 15:47:06 +00:00
George Kiagiadakis
16c1a7fe33 spa-device-factory: destroy device when the creator resource is destroyed 2020-06-02 15:47:06 +00:00
Wim Taymans
09913ca4ab metadata: free when the global is destroyed 2020-06-02 17:16:09 +02:00
Wim Taymans
4060934109 client-node: keep track of the client allocated fd
when we get port_buffers with memory from the client, store this
in the buffer data and make sure we close the fd when the buffers
are removed.
2020-06-02 15:19:39 +02:00
Wim Taymans
c04a9b546d client-node: refuse the wrong amount of client buffers
Make sure we get the same amount of buffers from the client as
we asked to allocate.
2020-06-02 15:18:18 +02:00
Wim Taymans
bb1cb530fc add more debug of fd create and close 2020-06-02 14:06:51 +02:00
George Kiagiadakis
6ecbe00774 session-manager: emit cached info with CHANGE_MASK_ALL on new resources 2020-06-01 16:25:40 +00:00
Wim Taymans
6a689b3c7f client-node: don't ref destroyed resource
Ownership of the node_resource is taken by _new() and freed.
Don't try to use it afterwards to send an error when something
goes wrong but use the original resource.
2020-05-20 15:24:25 +02:00
Wim Taymans
963b00b77b adapter: return an error when we can't find a format 2020-05-20 15:24:25 +02:00
Wim Taymans
c2028a1695 Fix some leaks in error cases 2020-05-20 15:24:25 +02:00
Wim Taymans
8669fd03a6 initialize variables better 2020-05-20 15:24:25 +02:00
Wim Taymans
ce98162ed2 Make sure we don't read too much 2020-05-20 15:24:25 +02:00
Wim Taymans
eb93f259e0 avoid some useless assignments 2020-05-20 15:24:25 +02:00
Wim Taymans
459acda619 client-node: use spa_system functions 2020-05-20 15:24:25 +02:00
Wim Taymans
a19bab4b16 avoid following NULL pointers 2020-05-20 15:24:25 +02:00
Wim Taymans
a898f21c87 improve debug
When we fail to read the eventfd, don't try to use the value.
2020-05-20 15:24:25 +02:00
Wim Taymans
9e6a047788 portal: add portal module again
Add this again for now until we can integrate this into the
session manager somehow.
2020-05-18 16:30:09 +02:00
Wim Taymans
fdb3985f1a client-node: handle NULL port
Don't try to remove an already removed port.
2020-05-12 10:12:28 +02:00
Wim Taymans
cfce048528 adapter: pass error to factory 2020-05-08 16:18:10 +02:00
Wim Taymans
2c13b3ecd2 client-node-v0: return -ENOENT when parameter not found 2020-05-07 10:42:19 +02:00
Wim Taymans
9049f1fdbb spa-node: don't warn on properties
When the node does not support enum_params or when the Props param
is not supported, suppress the warning.
2020-05-04 13:02:30 +02:00
Wim Taymans
940ff7f53b client-node: improve error reporting
Separate read failure and missed wakeup in 2 messages.
2020-05-01 11:23:54 +02:00
Wim Taymans
3324a15fe3 protocol: use bool for Bool pod 2020-04-30 17:12:20 +02:00
Wim Taymans
0fd46d057e remote: free io area after we set the new area
First set the new area, then destroy the old one. Otherwise the
data thread might still be using the old area and crash.
2020-04-30 16:13:50 +02:00
Wim Taymans
acd9991bfc remote-node: remove unused position area 2020-04-30 11:55:46 +02:00
Wim Taymans
856e1fe812 client-node: don't error in cleanup
It's possible the cleanup code might try to clean up ports we
already removed, don't show an error on that.
2020-04-28 13:56:23 +02:00
Wim Taymans
aafd1e7298 improve debug
Improve log so that debug level 3 gives a reasonably readable overview
of what is going on.
2020-04-22 12:47:18 +02:00
Wim Taymans
ee5c3349a0 client-node: don't try to clear port when destroyed
When the client destroyed a port, don't try to clear the
buffers because the client should have done that already.
2020-04-21 15:54:51 +02:00
Wim Taymans
48036f7d13 improve debug 2020-04-21 15:51:55 +02:00
Wim Taymans
0b68d65ebf metadata: trigger emission of properties
When the resource does add_listener, send a message to the proxy
to trigger an emission of properties.
Block the client until all properties have been notified, track
this with a ping event to the implementation.
2020-04-20 11:51:20 +02:00
Wim Taymans
ab3a6d3441 Fix some compiler warnings on arm 2020-04-03 13:18:02 +02:00
Wim Taymans
22e590c7cc stream: somewhat implement drain better
Abuse the xrun callback in the adapter to emit the drained signal until
almost all data left the resampler. This needs more work with a proper
signal and a buffer flag to signal the drain.
2020-04-02 17:46:50 +02:00
Wim Taymans
d1091462ab transport: init io_buffers with SPA_IO_BUFFERS_INIT 2020-04-02 15:36:56 +02:00
Wim Taymans
74ab04af26 client-node: use BUFFER_INIT to reset io_buffers 2020-04-02 15:31:58 +02:00
Wim Taymans
a86f70c13d protocol-native: avoid destroying NULL source
The source might have been destroyed before.
2020-04-02 15:25:13 +02:00
George Kiagiadakis
e918d60959 session-manager: implement factories for session, endpoint-stream & endpoint-link
Heavily based on the endpoint factory
2020-03-27 14:56:07 +00:00
George Kiagiadakis
444d180218 session-manager: endpoint: implement caching info & params
The info structure needs to be cached because there is no way to
request it from the implementation, unless we hack the add_listener
API to be used for making info requests or add a new method that
will be used just in the implementation (both are bad ideas).

The params are cached because
1) a client doing enum_params + sync will not work correctly, since
 the sync call syncs with the server and not the implementation...
 we could block the client to solve that, but then there is also #2
2) the implementation is not aware of the clients and therefore
 it cannot keep track of who is subscribed and who is not, this
 needs to happen in the server. Then if we only keep track of the
 subscriptions in the server and keep requesting params from the
 impl, there is no way to know if a param event coming from the
 impl matches a call to enum_params or to subscribe or if it's
 just an update that needs to be forwarded to subscribers.
2020-03-27 14:56:07 +00:00
George Kiagiadakis
df66edd9ab session-manager: implement 'endpoint' factory
This is modeled after the 'metadata' factory and provides
a way to use the pw_endpoint interface directly to implement
an endpoint object in a client.
2020-03-27 14:56:07 +00:00
George Kiagiadakis
0a8ec0380b session-manager: check error code when registering the marshallers 2020-03-27 14:56:07 +00:00
George Kiagiadakis
e971a79fce session-manager: implement export functions for session-manager objects 2020-03-27 14:56:07 +00:00