mirror of
https://github.com/neutrinolabs/pulseaudio-module-xrdp.git
synced 2025-06-03 06:30:16 +00:00
use fd -1 not 0 for invalid fd
This commit is contained in:
parent
1d4947dc34
commit
0bc53f5b40
@ -256,7 +256,7 @@ static int data_send(struct userdata *u, pa_memchunk *chunk) {
|
|||||||
struct header h;
|
struct header h;
|
||||||
struct sockaddr_un s;
|
struct sockaddr_un s;
|
||||||
|
|
||||||
if (u->fd == 0) {
|
if (u->fd == -1) {
|
||||||
if (u->failed_connect_time != 0) {
|
if (u->failed_connect_time != 0) {
|
||||||
if (pa_rtclock_now() - u->failed_connect_time < 1000000) {
|
if (pa_rtclock_now() - u->failed_connect_time < 1000000) {
|
||||||
return 0;
|
return 0;
|
||||||
@ -307,7 +307,7 @@ static int data_send(struct userdata *u, pa_memchunk *chunk) {
|
|||||||
if (lsend(u->fd, (char*)(&h), 8) != 8) {
|
if (lsend(u->fd, (char*)(&h), 8) != 8) {
|
||||||
pa_log("data_send: send failed");
|
pa_log("data_send: send failed");
|
||||||
close(u->fd);
|
close(u->fd);
|
||||||
u->fd = 0;
|
u->fd = -1;
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
pa_log_debug("data_send: sent header ok bytes %d", bytes);
|
pa_log_debug("data_send: sent header ok bytes %d", bytes);
|
||||||
@ -321,7 +321,7 @@ static int data_send(struct userdata *u, pa_memchunk *chunk) {
|
|||||||
if (sent != bytes) {
|
if (sent != bytes) {
|
||||||
pa_log("data_send: send failed sent %d bytes %d", sent, bytes);
|
pa_log("data_send: send failed sent %d bytes %d", sent, bytes);
|
||||||
close(u->fd);
|
close(u->fd);
|
||||||
u->fd = 0;
|
u->fd = -1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -332,7 +332,7 @@ static int close_send(struct userdata *u) {
|
|||||||
struct header h;
|
struct header h;
|
||||||
|
|
||||||
pa_log("close_send:");
|
pa_log("close_send:");
|
||||||
if (u->fd == 0) {
|
if (u->fd == -1) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
h.code = 1;
|
h.code = 1;
|
||||||
@ -340,7 +340,7 @@ static int close_send(struct userdata *u) {
|
|||||||
if (lsend(u->fd, (char*)(&h), 8) != 8) {
|
if (lsend(u->fd, (char*)(&h), 8) != 8) {
|
||||||
pa_log("close_send: send failed");
|
pa_log("close_send: send failed");
|
||||||
close(u->fd);
|
close(u->fd);
|
||||||
u->fd = 0;
|
u->fd = -1;
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
pa_log_debug("close_send: sent header ok");
|
pa_log_debug("close_send: sent header ok");
|
||||||
@ -497,6 +497,8 @@ int pa__init(pa_module*m) {
|
|||||||
|
|
||||||
u->display_num = get_display_num_from_display(getenv("DISPLAY"));
|
u->display_num = get_display_num_from_display(getenv("DISPLAY"));
|
||||||
|
|
||||||
|
u->fd = -1;
|
||||||
|
|
||||||
#if defined(PA_CHECK_VERSION)
|
#if defined(PA_CHECK_VERSION)
|
||||||
#if PA_CHECK_VERSION(0, 9, 22)
|
#if PA_CHECK_VERSION(0, 9, 22)
|
||||||
if (!(u->thread = pa_thread_new("xrdp-sink", thread_func, u))) {
|
if (!(u->thread = pa_thread_new("xrdp-sink", thread_func, u))) {
|
||||||
|
Loading…
Reference in New Issue
Block a user