mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-01-11 21:44:49 +00:00
daemon: make TCP default if not HAVE_UNIX_SOCKETS
This commit is contained in:
parent
33845bfee4
commit
42963ecee0
@ -87,6 +87,16 @@ static int socket_packet_handler(connection_t *connection, uint16_t packet_type,
|
||||
// init BTstack library
|
||||
int bt_open(void){
|
||||
|
||||
#ifndef HAVE_UNIX_SOCKETS
|
||||
// without unix sockets, default to TCP
|
||||
if (!daemon_tcp_address){
|
||||
daemon_tcp_address = "127.0.0.1";
|
||||
}
|
||||
if (!daemon_tcp_port){
|
||||
daemon_tcp_port = BTSTACK_PORT;
|
||||
}
|
||||
#endif
|
||||
|
||||
socket_connection_init();
|
||||
|
||||
socket_connection_register_packet_callback(socket_packet_handler);
|
||||
@ -95,7 +105,9 @@ int bt_open(void){
|
||||
if (daemon_tcp_address) {
|
||||
btstack_connection = socket_connection_open_tcp(daemon_tcp_address,daemon_tcp_port);
|
||||
} else {
|
||||
#ifdef HAVE_UNIX_SOCKETS
|
||||
btstack_connection = socket_connection_open_unix();
|
||||
#endif
|
||||
}
|
||||
if (!btstack_connection) return -1;
|
||||
|
||||
|
@ -1955,6 +1955,11 @@ int main (int argc, char * const * argv){
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef HAVE_UNIX_SOCKETS
|
||||
// TCP is default if there are no unix sockets
|
||||
tcp_flag = 1;
|
||||
#endif
|
||||
|
||||
if (tcp_flag){
|
||||
printf("BTstack Daemon started on port %u\n", BTSTACK_PORT);
|
||||
} else {
|
||||
@ -2096,7 +2101,9 @@ int main (int argc, char * const * argv){
|
||||
if (tcp_flag) {
|
||||
socket_connection_create_tcp(BTSTACK_PORT);
|
||||
} else {
|
||||
#ifdef HAVE_UNIX_SOCKETS
|
||||
socket_connection_create_unix(BTSTACK_UNIX);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
socket_connection_register_packet_callback(&daemon_client_handler);
|
||||
|
Loading…
Reference in New Issue
Block a user