remove some unused event and seqnum

This commit is contained in:
Wim Taymans 2017-03-09 19:21:50 +01:00
parent 1e600713a5
commit 8fbcb0fef1
9 changed files with 42 additions and 127 deletions

View file

@ -78,8 +78,6 @@ pinos_connection_add_fd (PinosConnection *conn,
return index;
}
#define PINOS_DEBUG_MESSAGE(format,args...) pinos_log_trace(format,##args)
static void *
connection_ensure_size (PinosConnection *conn, ConnectionBuffer *buf, size_t size)
{
@ -129,7 +127,7 @@ refill_buffer (PinosConnection *conn, ConnectionBuffer *buf)
buf->n_fds = (cmsg->cmsg_len - ((char *)CMSG_DATA (cmsg) - (char *)cmsg)) / sizeof (int);
memcpy (buf->fds, CMSG_DATA (cmsg), buf->n_fds * sizeof (int));
}
PINOS_DEBUG_MESSAGE ("connection %p: %d read %zd bytes and %d fds", conn, conn->fd, len, buf->n_fds);
pinos_log_trace ("connection %p: %d read %zd bytes and %d fds", conn, conn->fd, len, buf->n_fds);
return true;
@ -342,7 +340,7 @@ pinos_connection_flush (PinosConnection *conn)
}
break;
}
PINOS_DEBUG_MESSAGE ("connection %p: %d written %zd bytes and %u fds", conn, conn->fd, len, buf->n_fds);
pinos_log_trace ("connection %p: %d written %zd bytes and %u fds", conn, conn->fd, len, buf->n_fds);
buf->buffer_size -= len;
buf->n_fds = 0;

View file

@ -126,8 +126,6 @@ core_event_done (void *object,
PinosContext *this = proxy->context;
if (seq == 0) {
pinos_core_do_sync (this->core_proxy, 1);
} else if (seq == 1) {
context_set_state (this, PINOS_CONTEXT_STATE_CONNECTED, NULL);
}
}
@ -193,12 +191,6 @@ static const PinosModuleEvents module_events = {
&module_event_info,
};
static void
node_event_done (void *object,
uint32_t seq)
{
}
static void
node_event_info (void *object,
PinosNodeInfo *info)
@ -224,7 +216,6 @@ node_event_info (void *object,
}
static const PinosNodeEvents node_events = {
&node_event_done,
&node_event_info
};
@ -403,10 +394,8 @@ on_context_data (SpaSource *source,
demarshal = proxy->iface->events;
if (demarshal[opcode]) {
if (!demarshal[opcode] (proxy, message, size)) {
if (!demarshal[opcode] (proxy, message, size))
pinos_log_error ("context %p: invalid message received %u", this, opcode);
spa_debug_pod (message);
}
} else
pinos_log_error ("context %p: function %d not implemented", this, opcode);
@ -612,8 +601,10 @@ pinos_context_connect_fd (PinosContext *context,
context->registry_proxy->implementation = &registry_events;
pinos_core_do_get_registry (context->core_proxy,
0,
context->registry_proxy->id);
pinos_core_do_sync (context->core_proxy, 0);
return true;
no_registry:

View file

@ -48,16 +48,13 @@ typedef struct {
void (*sync) (void *object,
uint32_t seq);
void (*get_registry) (void *object,
uint32_t seq,
uint32_t new_id);
void (*create_node) (void *object,
uint32_t seq,
const char *factory_name,
const char *name,
const SpaDict *props,
uint32_t new_id);
void (*create_client_node) (void *object,
uint32_t seq,
const char *name,
const SpaDict *props,
uint32_t new_id);
@ -114,13 +111,10 @@ typedef struct {
#define pinos_module_notify_info(r,...) ((PinosModuleEvents*)r->iface->events)->info(r,__VA_ARGS__)
typedef struct {
void (*done) (void *object,
uint32_t seq);
void (*info) (void *object,
PinosNodeInfo *info);
} PinosNodeEvents;
#define pinos_node_notify_done(r,...) ((PinosNodeEvents*)r->iface->events)->done(r,__VA_ARGS__)
#define pinos_node_notify_info(r,...) ((PinosNodeEvents*)r->iface->events)->info(r,__VA_ARGS__)
struct _PinosClientNodeBuffer {
@ -157,19 +151,17 @@ typedef struct {
SpaNodeState state);
void (*event) (void *object,
SpaNodeEvent *event);
void (*destroy) (void *object,
uint32_t seq);
void (*destroy) (void *object);
} PinosClientNodeMethods;
#define pinos_client_node_do_update(r,...) ((PinosClientNodeMethods*)r->iface->methods)->update(r,__VA_ARGS__)
#define pinos_client_node_do_port_update(r,...) ((PinosClientNodeMethods*)r->iface->methods)->port_update(r,__VA_ARGS__)
#define pinos_client_node_do_state_change(r,...) ((PinosClientNodeMethods*)r->iface->methods)->state_change(r,__VA_ARGS__)
#define pinos_client_node_do_event(r,...) ((PinosClientNodeMethods*)r->iface->methods)->event(r,__VA_ARGS__)
#define pinos_client_node_do_destroy(r,...) ((PinosClientNodeMethods*)r->iface->methods)->destroy(r,__VA_ARGS__)
#define pinos_client_node_do_destroy(r) ((PinosClientNodeMethods*)r->iface->methods)->destroy(r)
typedef struct {
void (*done) (void *object,
uint32_t seq,
int datafd);
void (*event) (void *object,
const SpaNodeEvent *event);

View file

@ -94,7 +94,6 @@ core_marshal_sync (void *object,
static void
core_marshal_get_registry (void *object,
uint32_t seq,
uint32_t new_id)
{
PinosProxy *proxy = object;
@ -104,7 +103,6 @@ core_marshal_get_registry (void *object,
spa_pod_builder_add (&b.b,
SPA_POD_TYPE_STRUCT, &f,
SPA_POD_TYPE_INT, seq,
SPA_POD_TYPE_INT, new_id,
-SPA_POD_TYPE_STRUCT, &f,
0);
@ -114,7 +112,6 @@ core_marshal_get_registry (void *object,
static void
core_marshal_create_node (void *object,
uint32_t seq,
const char *factory_name,
const char *name,
const SpaDict *props,
@ -130,7 +127,6 @@ core_marshal_create_node (void *object,
spa_pod_builder_add (&b.b,
SPA_POD_TYPE_STRUCT, &f,
SPA_POD_TYPE_INT, seq,
SPA_POD_TYPE_STRING, factory_name,
SPA_POD_TYPE_STRING, name,
SPA_POD_TYPE_INT, n_items, 0);
@ -150,7 +146,6 @@ core_marshal_create_node (void *object,
static void
core_marshal_create_client_node (void *object,
uint32_t seq,
const char *name,
const SpaDict *props,
uint32_t new_id)
@ -165,7 +160,6 @@ core_marshal_create_client_node (void *object,
spa_pod_builder_add (&b.b,
SPA_POD_TYPE_STRUCT, &f,
SPA_POD_TYPE_INT, seq,
SPA_POD_TYPE_STRING, name,
SPA_POD_TYPE_INT, n_items, 0);
@ -314,25 +308,6 @@ module_demarshal_info (void *object,
return true;
}
static bool
node_demarshal_done (void *object,
void *data,
size_t size)
{
PinosProxy *proxy = object;
SpaPODIter it;
uint32_t seq;
if (!spa_pod_iter_struct (&it, data, size) ||
!spa_pod_iter_get (&it,
SPA_POD_TYPE_INT, &seq,
0))
return false;
((PinosNodeEvents*)proxy->implementation)->done (proxy, seq);
return true;
}
static bool
node_demarshal_info (void *object,
void *data,
@ -517,8 +492,7 @@ client_node_marshal_event (void *object,
}
static void
client_node_marshal_destroy (void *object,
uint32_t seq)
client_node_marshal_destroy (void *object)
{
PinosProxy *proxy = object;
PinosConnection *connection = proxy->context->protocol_private;
@ -527,7 +501,6 @@ client_node_marshal_destroy (void *object,
spa_pod_builder_add (&b.b,
SPA_POD_TYPE_STRUCT, &f,
SPA_POD_TYPE_INT, seq,
-SPA_POD_TYPE_STRUCT, &f,
0);
@ -542,18 +515,17 @@ client_node_demarshal_done (void *object,
PinosProxy *proxy = object;
SpaPODIter it;
PinosConnection *connection = proxy->context->protocol_private;
int32_t seq, idx;
int32_t idx;
int fd;
if (!spa_pod_iter_struct (&it, data, size) ||
!spa_pod_iter_get (&it,
SPA_POD_TYPE_INT, &seq,
SPA_POD_TYPE_INT, &idx,
0))
return false;
fd = pinos_connection_get_fd (connection, idx);
((PinosClientNodeEvents*)proxy->implementation)->done (proxy, seq, fd);
((PinosClientNodeEvents*)proxy->implementation)->done (proxy, fd);
return true;
}
@ -1031,13 +1003,12 @@ static const PinosInterface pinos_protocol_native_client_module_interface = {
};
static const PinosDemarshalFunc pinos_protocol_native_client_node_demarshal[] = {
&node_demarshal_done,
&node_demarshal_info,
};
static const PinosInterface pinos_protocol_native_client_node_interface = {
0, NULL,
2, pinos_protocol_native_client_node_demarshal,
1, pinos_protocol_native_client_node_demarshal,
};
static const PinosDemarshalFunc pinos_protocol_native_client_client_demarshal[] = {

View file

@ -19,6 +19,7 @@
#include <pinos/client/log.h>
#include <pinos/client/proxy.h>
#include <pinos/client/protocol-native.h>
typedef struct {
PinosProxy this;

View file

@ -64,8 +64,6 @@ typedef struct
SpaNodeState node_state;
uint32_t seq;
uint32_t n_possible_formats;
SpaFormat **possible_formats;
@ -661,7 +659,6 @@ handle_node_command (PinosStream *stream,
static void
client_node_done (void *object,
uint32_t seq,
int datafd)
{
PinosProxy *proxy = object;
@ -1000,7 +997,6 @@ pinos_stream_connect (PinosStream *stream,
impl->node_proxy->implementation = &client_node_events;
pinos_core_do_create_client_node (stream->context->core_proxy,
++impl->seq,
"client-node",
&stream->properties->dict,
impl->node_proxy->id);
@ -1101,7 +1097,7 @@ pinos_stream_disconnect (PinosStream *stream)
unhandle_socket (stream);
pinos_client_node_do_destroy (impl->node_proxy, ++impl->seq);
pinos_client_node_do_destroy (impl->node_proxy);
return true;
}

View file

@ -971,8 +971,7 @@ client_node_event (void *object,
}
static void
client_node_destroy (void *object,
uint32_t seq)
client_node_destroy (void *object)
{
PinosResource *resource = object;
PinosClientNode *node = resource->object;

View file

@ -100,7 +100,6 @@ core_sync (void *object,
static void
core_get_registry (void *object,
uint32_t seq,
uint32_t new_id)
{
PinosResource *resource = object;
@ -126,8 +125,6 @@ core_get_registry (void *object,
global->id,
spa_id_map_get_uri (this->uri.map, global->type));
pinos_core_notify_done (client->core_resource, seq);
return;
no_mem:
@ -140,7 +137,6 @@ no_mem:
static void
core_create_node (void *object,
uint32_t seq,
const char *factory_name,
const char *name,
const SpaDict *props,
@ -157,7 +153,6 @@ core_create_node (void *object,
static void
core_create_client_node (void *object,
uint32_t seq,
const char *name,
const SpaDict *props,
uint32_t new_id)
@ -194,7 +189,6 @@ core_create_client_node (void *object,
}
pinos_client_node_notify_done (node->resource,
seq,
data_fd);
return;

View file

@ -195,16 +195,15 @@ core_demarshal_get_registry (void *object,
{
PinosResource *resource = object;
SpaPODIter it;
int32_t seq, new_id;
int32_t new_id;
if (!spa_pod_iter_struct (&it, data, size) ||
!spa_pod_iter_get (&it,
SPA_POD_TYPE_INT, &seq,
SPA_POD_TYPE_INT, &new_id,
0))
return false;
((PinosCoreMethods*)resource->implementation)->get_registry (resource, seq, new_id);
((PinosCoreMethods*)resource->implementation)->get_registry (resource, new_id);
return true;
}
@ -215,13 +214,12 @@ core_demarshal_create_node (void *object,
{
PinosResource *resource = object;
SpaPODIter it;
uint32_t seq, new_id, i;
uint32_t new_id, i;
const char *factory_name, *name;
SpaDict props;
if (!spa_pod_iter_struct (&it, data, size) ||
!spa_pod_iter_get (&it,
SPA_POD_TYPE_INT, &seq,
SPA_POD_TYPE_STRING, &factory_name,
SPA_POD_TYPE_STRING, &name,
SPA_POD_TYPE_INT, &props.n_items,
@ -240,7 +238,6 @@ core_demarshal_create_node (void *object,
return false;
((PinosCoreMethods*)resource->implementation)->create_node (resource,
seq,
factory_name,
name,
&props,
@ -255,13 +252,12 @@ core_demarshal_create_client_node (void *object,
{
PinosResource *resource = object;
SpaPODIter it;
uint32_t seq, new_id, i;
uint32_t new_id, i;
const char *name;
SpaDict props;
if (!spa_pod_iter_struct (&it, data, size) ||
!spa_pod_iter_get (&it,
SPA_POD_TYPE_INT, &seq,
SPA_POD_TYPE_STRING, &name,
SPA_POD_TYPE_INT, &props.n_items,
0))
@ -279,7 +275,6 @@ core_demarshal_create_client_node (void *object,
return false;
((PinosCoreMethods*)resource->implementation)->create_client_node (resource,
seq,
name,
&props,
new_id);
@ -374,23 +369,6 @@ module_marshal_info (void *object,
pinos_connection_end_write (connection, resource->id, 0, b.b.offset);
}
static void
node_marshal_done (void *object,
uint32_t seq)
{
PinosResource *resource = object;
PinosConnection *connection = resource->client->protocol_private;
Builder b = { { NULL, 0, 0, NULL, write_pod }, connection };
SpaPODFrame f;
spa_pod_builder_add (&b.b,
SPA_POD_TYPE_STRUCT, &f,
SPA_POD_TYPE_INT, seq,
-SPA_POD_TYPE_STRUCT, &f, 0);
pinos_connection_end_write (connection, resource->id, 0, b.b.offset);
}
static void
node_marshal_info (void *object,
PinosNodeInfo *info)
@ -435,7 +413,7 @@ node_marshal_info (void *object,
}
spa_pod_builder_add (&b.b, -SPA_POD_TYPE_STRUCT, &f, 0);
pinos_connection_end_write (connection, resource->id, 1, b.b.offset);
pinos_connection_end_write (connection, resource->id, 0, b.b.offset);
}
static void
@ -468,7 +446,6 @@ client_marshal_info (void *object,
static void
client_node_marshal_done (void *object,
uint32_t seq,
int datafd)
{
PinosResource *resource = object;
@ -478,7 +455,6 @@ client_node_marshal_done (void *object,
spa_pod_builder_add (&b.b,
SPA_POD_TYPE_STRUCT, &f,
SPA_POD_TYPE_INT, seq,
SPA_POD_TYPE_INT, pinos_connection_add_fd (connection, datafd),
-SPA_POD_TYPE_STRUCT, &f, 0);
@ -884,13 +860,11 @@ client_node_demarshal_destroy (void *object,
{
PinosResource *resource = object;
SpaPODIter it;
uint32_t seq;
if (!spa_pod_iter_struct (&it, data, size) ||
!spa_pod_iter_get (&it, SPA_POD_TYPE_INT, &seq, 0))
if (!spa_pod_iter_struct (&it, data, size))
return false;
((PinosClientNodeMethods*)resource->implementation)->destroy (resource, seq);
((PinosClientNodeMethods*)resource->implementation)->destroy (resource);
return true;
}
@ -960,13 +934,12 @@ const PinosInterface pinos_protocol_native_server_module_interface = {
};
static const PinosNodeEvents pinos_protocol_native_server_node_events = {
&node_marshal_done,
&node_marshal_info,
};
const PinosInterface pinos_protocol_native_server_node_interface = {
0, NULL,
2, &pinos_protocol_native_server_node_events,
1, &pinos_protocol_native_server_node_events,
};
static const PinosClientEvents pinos_protocol_native_server_client_events = {