diff --git a/src/frameserver/util/anet_helper.h b/src/frameserver/util/anet_helper.h index 7fd6a350d..cda94dd72 100644 --- a/src/frameserver/util/anet_helper.h +++ b/src/frameserver/util/anet_helper.h @@ -35,6 +35,10 @@ struct anet_options { * 'default' will be used */ const char* host_tag; +/* petname used to register as a source/linked directory in another - this is a + * hint, the server may well assign a different one */ + const char petname[16]; + /* pre-inherited socket to use */ int sockfd; @@ -51,7 +55,6 @@ struct anet_options { const char* redirect_exit; /* similarly, remember any local connection point and use that */ - const char* devicehint_cp; /* allow connection retries, -1 infinite, 0 no retry */ diff --git a/src/shmif/arcan_shmif_server.c b/src/shmif/arcan_shmif_server.c index 4d6e681e9..32207697a 100644 --- a/src/shmif/arcan_shmif_server.c +++ b/src/shmif/arcan_shmif_server.c @@ -179,7 +179,7 @@ struct shmifsrv_client* shmifsrv_spawn_client( return NULL; } - *clsocket = res->con->dpipe; + *clsocket = childend; res->cookie = arcan_shmif_cookie(); res->status = AUTHENTICATING; @@ -354,8 +354,10 @@ int shmifsrv_poll(struct shmifsrv_client* cl) int a = !!(atomic_load(&cl->con->shm.ptr->aready)); int v = !!(atomic_load(&cl->con->shm.ptr->vready)); shmifsrv_leave(); - return - (CLIENT_VBUFFER_READY * v) | (CLIENT_ABUFFER_READY * a); + if (a || v) + return + (CLIENT_VBUFFER_READY * v) | (CLIENT_ABUFFER_READY * a); + return CLIENT_IDLE; } else cl->status = BROKEN; @@ -598,7 +600,9 @@ bool shmifsrv_tick(struct shmifsrv_client* cl) return true; } -static int64_t timebase, c_ticks; +static _Thread_local int64_t timebase; +static _Thread_local int64_t c_ticks; + int shmifsrv_monotonic_tick(int* left) { int64_t now = arcan_timemillis(); diff --git a/src/shmif/arcan_shmif_server.h b/src/shmif/arcan_shmif_server.h index 8986dc930..879e984cf 100644 --- a/src/shmif/arcan_shmif_server.h +++ b/src/shmif/arcan_shmif_server.h @@ -46,6 +46,8 @@ struct shmifsrv_client; * preroll- event stage. */ struct shmifsrv_envp { + + int fd_bin; char* path; char** argv; char** envv; @@ -188,7 +190,8 @@ enum shmifsrv_client_status { CLIENT_DEAD = -1, CLIENT_NOT_READY = 0, CLIENT_VBUFFER_READY = 1, - CLIENT_ABUFFER_READY = 2 + CLIENT_ABUFFER_READY = 2, + CLIENT_IDLE = 3 }; int shmifsrv_poll(struct shmifsrv_client*); @@ -197,10 +200,6 @@ int shmifsrv_poll(struct shmifsrv_client*); * been created through shmifsrv_allocate_connpoint and is still in a listening * state, the underlying descriptor won't be closed in order for the connpoint * to be reused. - * - * If [full] is set to false, the client will not be directly told that the - * connection is dead via the normal 'dead-man-switch' handle, only through - * the event-queue - forcing the client to try and use some recovery mechanism. */ enum shmifsrv_action { SHMIFSRV_FREE_FULL = 0, @@ -335,7 +334,7 @@ bool shmifsrv_audio(struct shmifsrv_client* cl, size_t n_samples, unsigned channels, unsigned rate, void* tag), void* tag); /* - * [THREAD_UNSAFE] + * [THREAD:USES_TLS] * This is a helper function that returns the number of monotonic ticks * since the last time this function was called. It is thus a global state * shared by many clients, along with the optional time to next tick. The @@ -351,7 +350,7 @@ bool shmifsrv_audio(struct shmifsrv_client* cl, int shmifsrv_monotonic_tick(int* left); /* - * [THREAD_UNSAFE] + * [THREAD:USES_TLS] * Explicitly rebase the shared clock counter due to a large stall, * pause, global suspend action and so on. */