2 |
// |
// |
3 |
/**************************************************************************** |
/**************************************************************************** |
4 |
liblscp - LinuxSampler Control Protocol API |
liblscp - LinuxSampler Control Protocol API |
5 |
Copyright (C) 2004-2019, 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 |
192 |
pConnect->server = pServer; |
pConnect->server = pServer; |
193 |
pConnect->events = LSCP_EVENT_NONE; |
pConnect->events = LSCP_EVENT_NONE; |
194 |
|
|
195 |
#ifdef DEBUG |
#ifdef CONFIG_DEBUG |
196 |
fprintf(stderr, "_lscp_connect_create: pConnect=%p: sock=%d addr=%s port=%d.\n", pConnect, sock, inet_ntoa(pAddr->sin_addr), ntohs(pAddr->sin_port)); |
fprintf(stderr, "_lscp_connect_create: pConnect=%p: sock=%d addr=%s port=%d.\n", pConnect, sock, inet_ntoa(pAddr->sin_addr), ntohs(pAddr->sin_port)); |
197 |
#endif |
#endif |
198 |
|
|
217 |
if (pConnect == NULL) |
if (pConnect == NULL) |
218 |
return ret; |
return ret; |
219 |
|
|
220 |
#ifdef DEBUG |
#ifdef CONFIG_DEBUG |
221 |
fprintf(stderr, "_lscp_connect_destroy: pConnect=%p.\n", pConnect); |
fprintf(stderr, "_lscp_connect_destroy: pConnect=%p.\n", pConnect); |
222 |
#endif |
#endif |
223 |
|
|
263 |
socklen_t cAddr; |
socklen_t cAddr; |
264 |
lscp_connect_t *pConnect; |
lscp_connect_t *pConnect; |
265 |
|
|
266 |
#ifdef DEBUG |
#ifdef CONFIG_DEBUG |
267 |
fprintf(stderr, "_lscp_server_thread_proc: Server listening for connections.\n"); |
fprintf(stderr, "_lscp_server_thread_proc: Server listening for connections.\n"); |
268 |
#endif |
#endif |
269 |
|
|
282 |
} |
} |
283 |
} |
} |
284 |
|
|
285 |
#ifdef DEBUG |
#ifdef CONFIG_DEBUG |
286 |
fprintf(stderr, "_lscp_server_thread_proc: Server closing.\n"); |
fprintf(stderr, "_lscp_server_thread_proc: Server closing.\n"); |
287 |
#endif |
#endif |
288 |
} |
} |
301 |
socklen_t cAddr; |
socklen_t cAddr; |
302 |
lscp_connect_t *pConnect; |
lscp_connect_t *pConnect; |
303 |
|
|
304 |
#ifdef DEBUG |
#ifdef CONFIG_DEBUG |
305 |
fprintf(stderr, "_lscp_server_select_proc: Server listening for connections.\n"); |
fprintf(stderr, "_lscp_server_select_proc: Server listening for connections.\n"); |
306 |
#endif |
#endif |
307 |
FD_ZERO(&master_fds); |
FD_ZERO(&master_fds); |
379 |
} |
} |
380 |
} |
} |
381 |
|
|
382 |
#ifdef DEBUG |
#ifdef CONFIG_DEBUG |
383 |
fprintf(stderr, "_lscp_server_select_proc: Server closing.\n"); |
fprintf(stderr, "_lscp_server_select_proc: Server closing.\n"); |
384 |
#endif |
#endif |
385 |
} |
} |
478 |
pServer->pfnCallback = pfnCallback; |
pServer->pfnCallback = pfnCallback; |
479 |
pServer->pvData = pvData; |
pServer->pvData = pvData; |
480 |
|
|
481 |
#ifdef DEBUG |
#ifdef CONFIG_DEBUG |
482 |
fprintf(stderr, "lscp_server_create: pServer=%p: iPort=%d.\n", pServer, iPort); |
fprintf(stderr, "lscp_server_create: pServer=%p: iPort=%d.\n", pServer, iPort); |
483 |
#endif |
#endif |
484 |
|
|
498 |
lscp_socket_perror("lscp_server_create: setsockopt(SO_DONTLINGER)"); |
lscp_socket_perror("lscp_server_create: setsockopt(SO_DONTLINGER)"); |
499 |
#endif |
#endif |
500 |
|
|
501 |
#ifdef DEBUG |
#ifdef CONFIG_DEBUG |
502 |
lscp_socket_getopts("lscp_server_create", sock); |
lscp_socket_getopts("lscp_server_create", sock); |
503 |
#endif |
#endif |
504 |
|
|
532 |
|
|
533 |
lscp_socket_agent_init(&(pServer->agent), sock, &addr, cAddr); |
lscp_socket_agent_init(&(pServer->agent), sock, &addr, cAddr); |
534 |
|
|
535 |
#ifdef DEBUG |
#ifdef CONFIG_DEBUG |
536 |
fprintf(stderr, "lscp_server_create: sock=%d addr=%s port=%d.\n", pServer->agent.sock, inet_ntoa(pServer->agent.addr.sin_addr), ntohs(pServer->agent.addr.sin_port)); |
fprintf(stderr, "lscp_server_create: sock=%d addr=%s port=%d.\n", pServer->agent.sock, inet_ntoa(pServer->agent.addr.sin_addr), ntohs(pServer->agent.addr.sin_port)); |
537 |
#endif |
#endif |
538 |
|
|
560 |
if (pServer == NULL) |
if (pServer == NULL) |
561 |
return LSCP_FAILED; |
return LSCP_FAILED; |
562 |
|
|
563 |
#ifdef DEBUG |
#ifdef CONFIG_DEBUG |
564 |
fprintf(stderr, "lscp_server_join: pServer=%p.\n", pServer); |
fprintf(stderr, "lscp_server_join: pServer=%p.\n", pServer); |
565 |
#endif |
#endif |
566 |
|
|
580 |
if (pServer == NULL) |
if (pServer == NULL) |
581 |
return LSCP_FAILED; |
return LSCP_FAILED; |
582 |
|
|
583 |
#ifdef DEBUG |
#ifdef CONFIG_DEBUG |
584 |
fprintf(stderr, "lscp_server_destroy: pServer=%p.\n", pServer); |
fprintf(stderr, "lscp_server_destroy: pServer=%p.\n", pServer); |
585 |
#endif |
#endif |
586 |
|
|