Don't reserve the topmost bit in NPObject ids
We explicitly advertise the type, so client and server each get distinct id spaces.
This commit is contained in:
parent
6947ea103e
commit
82851c108b
|
@ -77,11 +77,9 @@ uint32_t npobject_create_stub(NPObject *npobj)
|
|||
|
||||
static uint32_t next_id = 0;
|
||||
|
||||
// Allocate an id. Client and server get distinct id spaces.
|
||||
// Allocate an id. Client and server get separate id spaces because
|
||||
// of type field.
|
||||
uint32_t id = ++next_id;
|
||||
assert(id < (1<<31));
|
||||
if (rpc_is_server(g_rpc_connection))
|
||||
id |= (1<<31);
|
||||
|
||||
D(bug("npobject_create_stub: npobj=%p, id=0x%x\n", npobj, id));
|
||||
NPObjectStub *stub = g_new0(NPObjectStub, 1);
|
||||
|
|
|
@ -482,14 +482,9 @@ void rpc_connection_unref(rpc_connection_t *connection)
|
|||
}
|
||||
|
||||
// Returns whether we are in sync mode or not (i.e. needs other end sync)
|
||||
inline bool rpc_is_server(rpc_connection_t *connection)
|
||||
{
|
||||
return connection->type == RPC_CONNECTION_SERVER;
|
||||
}
|
||||
|
||||
static inline bool _rpc_connection_is_sync_mode(rpc_connection_t *connection)
|
||||
{
|
||||
return rpc_is_server(connection);
|
||||
return connection->type == RPC_CONNECTION_SERVER;
|
||||
}
|
||||
|
||||
// Returns whether we are allowed to synchronize with the other end
|
||||
|
|
|
@ -54,7 +54,6 @@ extern void rpc_connection_unref(rpc_connection_t *connection) attribute_hidden;
|
|||
|
||||
extern rpc_connection_t *rpc_init_server(const char *ident) attribute_hidden;
|
||||
extern rpc_connection_t *rpc_init_client(const char *ident) attribute_hidden;
|
||||
extern bool rpc_is_server(rpc_connection_t *connection) attribute_hidden;
|
||||
extern int rpc_exit(rpc_connection_t *connection) attribute_hidden;
|
||||
extern int rpc_listen_socket(rpc_connection_t *connection) attribute_hidden;
|
||||
extern int rpc_listen(rpc_connection_t *connection) attribute_hidden;
|
||||
|
|
Loading…
Reference in New Issue