2 |
// |
// |
3 |
/**************************************************************************** |
/**************************************************************************** |
4 |
liblscp - LinuxSampler Control Protocol API |
liblscp - LinuxSampler Control Protocol API |
5 |
Copyright (C) 2004-2020, rncbc aka Rui Nuno Capela. All rights reserved. |
Copyright (C) 2004-2021, rncbc aka Rui Nuno Capela. All rights reserved. |
6 |
|
|
7 |
This library is free software; you can redistribute it and/or |
This library is free software; you can redistribute it and/or |
8 |
modify it under the terms of the GNU Lesser General Public |
modify it under the terms of the GNU Lesser General Public |
108 |
|
|
109 |
lscp_event_t event; |
lscp_event_t event; |
110 |
|
|
111 |
#ifdef DEBUG |
#ifdef CONFIG_DEBUG |
112 |
fprintf(stderr, "_lscp_client_evt_proc: Client waiting for events.\n"); |
fprintf(stderr, "_lscp_client_evt_proc: Client waiting for events.\n"); |
113 |
#endif |
#endif |
114 |
|
|
177 |
lscp_cond_signal(pClient->cond); |
lscp_cond_signal(pClient->cond); |
178 |
} |
} |
179 |
|
|
180 |
#ifdef DEBUG |
#ifdef CONFIG_DEBUG |
181 |
fprintf(stderr, "_lscp_client_evt_proc: Client closing.\n"); |
fprintf(stderr, "_lscp_client_evt_proc: Client closing.\n"); |
182 |
#endif |
#endif |
183 |
} |
} |
209 |
lscp_socket_perror("lscp_client_evt_connect: setsockopt(SO_DONTLINGER)"); |
lscp_socket_perror("lscp_client_evt_connect: setsockopt(SO_DONTLINGER)"); |
210 |
#endif |
#endif |
211 |
|
|
212 |
#ifdef DEBUG |
#ifdef CONFIG_DEBUG |
213 |
lscp_socket_getopts("_lscp_client_evt_connect:", sock); |
lscp_socket_getopts("_lscp_client_evt_connect:", sock); |
214 |
#endif |
#endif |
215 |
|
|
364 |
pClient->pfnCallback = pfnCallback; |
pClient->pfnCallback = pfnCallback; |
365 |
pClient->pvData = pvData; |
pClient->pvData = pvData; |
366 |
|
|
367 |
#ifdef DEBUG |
#ifdef CONFIG_DEBUG |
368 |
fprintf(stderr, |
fprintf(stderr, |
369 |
"lscp_client_create: pClient=%p: pszHost=%s iPort=%d.\n", |
"lscp_client_create: pClient=%p: pszHost=%s iPort=%d.\n", |
370 |
pClient, pszHost, iPort); |
pClient, pszHost, iPort); |
389 |
(char *) &iSockOpt, sizeof(int)) == SOCKET_ERROR) |
(char *) &iSockOpt, sizeof(int)) == SOCKET_ERROR) |
390 |
lscp_socket_perror("lscp_client_create: cmd: setsockopt(SO_DONTLINGER)"); |
lscp_socket_perror("lscp_client_create: cmd: setsockopt(SO_DONTLINGER)"); |
391 |
#endif |
#endif |
392 |
#ifdef DEBUG |
#ifdef CONFIG_DEBUG |
393 |
lscp_socket_getopts("lscp_client_create: cmd", sock); |
lscp_socket_getopts("lscp_client_create: cmd", sock); |
394 |
#endif |
#endif |
395 |
if (connect(sock, res->ai_addr, res->ai_addrlen) != SOCKET_ERROR) |
if (connect(sock, res->ai_addr, res->ai_addrlen) != SOCKET_ERROR) |
431 |
lscp_socket_perror("lscp_client_create: cmd: setsockopt(SO_DONTLINGER)"); |
lscp_socket_perror("lscp_client_create: cmd: setsockopt(SO_DONTLINGER)"); |
432 |
#endif |
#endif |
433 |
|
|
434 |
#ifdef DEBUG |
#ifdef CONFIG_DEBUG |
435 |
lscp_socket_getopts("lscp_client_create: cmd", sock); |
lscp_socket_getopts("lscp_client_create: cmd", sock); |
436 |
#endif |
#endif |
437 |
|
|
453 |
|
|
454 |
#endif /* !USE_GETADDRINFO */ |
#endif /* !USE_GETADDRINFO */ |
455 |
|
|
456 |
#ifdef DEBUG |
#ifdef CONFIG_DEBUG |
457 |
fprintf(stderr, |
fprintf(stderr, |
458 |
"lscp_client_create: cmd: pClient=%p: sock=%d addr=%s port=%d.\n", |
"lscp_client_create: cmd: pClient=%p: sock=%d addr=%s port=%d.\n", |
459 |
pClient, pClient->cmd.sock, |
pClient, pClient->cmd.sock, |
520 |
if (pClient == NULL) |
if (pClient == NULL) |
521 |
return LSCP_FAILED; |
return LSCP_FAILED; |
522 |
|
|
523 |
#ifdef DEBUG |
#ifdef CONFIG_DEBUG |
524 |
fprintf(stderr, "lscp_client_join: pClient=%p.\n", pClient); |
fprintf(stderr, "lscp_client_join: pClient=%p.\n", pClient); |
525 |
#endif |
#endif |
526 |
|
|
543 |
if (pClient == NULL) |
if (pClient == NULL) |
544 |
return LSCP_FAILED; |
return LSCP_FAILED; |
545 |
|
|
546 |
#ifdef DEBUG |
#ifdef CONFIG_DEBUG |
547 |
fprintf(stderr, "lscp_client_destroy: pClient=%p.\n", pClient); |
fprintf(stderr, "lscp_client_destroy: pClient=%p.\n", pClient); |
548 |
#endif |
#endif |
549 |
|
|