mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-03-14 01:27:41 +00:00
try to ignore SIGPIPE, shorter power off timeout
This commit is contained in:
parent
583942ad47
commit
afef42bd47
@ -191,7 +191,7 @@ void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint
|
||||
bt_send_cmd(&hci_disconnect, wiiMoteConHandle, 0x13); // remote closed connection
|
||||
wiiMoteConHandle = 0;
|
||||
}
|
||||
bt_send_cmd(&btstack_set_power_mode, HCI_POWER_OFF );
|
||||
// bt_send_cmd(&btstack_set_power_mode, HCI_POWER_OFF );
|
||||
bt_close();
|
||||
|
||||
UIAlertView* alertView = [[UIAlertView alloc] init];
|
||||
@ -233,7 +233,7 @@ void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint
|
||||
if (wiiMoteConHandle) {
|
||||
bt_send_cmd(&hci_disconnect, wiiMoteConHandle, 0x13); // remote closed connection
|
||||
}
|
||||
bt_send_cmd(&btstack_set_power_mode, HCI_POWER_OFF );
|
||||
// bt_send_cmd(&btstack_set_power_mode, HCI_POWER_OFF );
|
||||
|
||||
bt_close();
|
||||
}
|
||||
|
18
src/daemon.c
18
src/daemon.c
@ -39,7 +39,7 @@
|
||||
#include "hci_transport_usb.h"
|
||||
#endif
|
||||
|
||||
#define DAEMON_NO_CONNECTION_TIMEOUT 60000
|
||||
#define DAEMON_NO_CONNECTION_TIMEOUT 20000
|
||||
|
||||
static hci_transport_t * transport;
|
||||
static hci_uart_config_t config;
|
||||
@ -188,6 +188,10 @@ static void daemon_sigint_handler(int param){
|
||||
exit(0);
|
||||
}
|
||||
|
||||
static void daemon_sigpipe_handler(int param){
|
||||
printf(" <= SIGPIPE received.. trying to ignore..\n");
|
||||
}
|
||||
|
||||
int main (int argc, const char * argv[]){
|
||||
|
||||
bt_control_t * control = NULL;
|
||||
@ -239,9 +243,17 @@ int main (int argc, const char * argv[]){
|
||||
signal(SIGINT, daemon_sigint_handler);
|
||||
// handle SIGTERM - suggested for launchd
|
||||
signal(SIGTERM, daemon_sigint_handler);
|
||||
#if 0
|
||||
// avoid crashing on closed socket
|
||||
signal(SIGPIPE, SIG_IGN);
|
||||
|
||||
signal(SIGPIPE, daemon_sigpipe_handler);
|
||||
#else 0
|
||||
struct sigaction act;
|
||||
act.sa_handler = SIG_IGN;
|
||||
sigemptyset (&act.sa_mask);
|
||||
act.sa_flags = 0;
|
||||
sigaction (SIGPIPE, &act, NULL);
|
||||
#endif
|
||||
|
||||
// make stderr unbuffered
|
||||
setbuf(stderr, NULL);
|
||||
setbuf(stdout, NULL);
|
||||
|
Loading…
x
Reference in New Issue
Block a user