runloop: set ds->process via setter

This commit is contained in:
Matthias Ringwald 2016-03-24 19:36:55 +01:00
parent 390cf48d42
commit 835c167141
5 changed files with 7 additions and 7 deletions

View File

@ -315,7 +315,7 @@ int socket_connection_create_tcp(int port){
btstack_data_source_t *ds = malloc( sizeof(btstack_data_source_t));
if (ds == NULL) return -1;
ds->fd = 0;
ds->process = socket_connection_accept;
btstack_run_loop_set_data_source_handler(ds, &socket_connection_accept);
// create tcp socket
if ((ds->fd = socket (PF_INET, SOCK_STREAM, 0)) < 0) {
@ -369,7 +369,7 @@ void socket_connection_launchd_register_fd_array(launch_data_t listening_fd_arra
// create btstack_data_source_t for fd
btstack_data_source_t *ds = malloc( sizeof(btstack_data_source_t));
if (ds == NULL) return;
ds->process = socket_connection_accept;
btstack_run_loop_set_data_source_handler(ds, &socket_connection_accept);
ds->fd = listening_fd;
btstack_run_loop_add_data_source(ds);
}
@ -456,7 +456,7 @@ int socket_connection_create_unix(char *path){
btstack_data_source_t *ds = malloc( sizeof(btstack_data_source_t));
if (ds == NULL) return -1;
ds->fd = 0;
ds->process = socket_connection_accept;
btstack_run_loop_set_data_source_handler(ds, &socket_connection_accept);
// create unix socket
if ((ds->fd = socket (AF_UNIX, SOCK_STREAM, 0)) < 0) {

View File

@ -213,7 +213,7 @@ static int h4_open(void){
if (!hci_transport_h4->ds) return -1;
hci_transport_h4->uart_fd = fd;
hci_transport_h4->ds->fd = fd;
hci_transport_h4->ds->process = h4_process;
btstack_run_loop_set_data_source_handler(hci_transport_h4, &h4_process);
btstack_run_loop_add_data_source(hci_transport_h4->ds);
// also set baudrate

View File

@ -225,7 +225,7 @@ static int h4_open(void)
hci_transport_h4->uart_fd = fd;
hci_transport_h4->ds->fd = fd;
hci_transport_h4->ds->process = h4_process;
btstack_run_loop_set_data_source_handler(hci_transport_h4, &h4_process);
btstack_run_loop_add_data_source(hci_transport_h4->ds);
// init state machine

View File

@ -844,7 +844,7 @@ static int usb_open(void){
for (r = 0 ; r < num_pollfds ; r++) {
btstack_data_source_t *ds = &pollfd_data_sources[r];
ds->fd = pollfd[r]->fd;
ds->process = usb_process_ds;
btstack_run_loop_set_data_source_handler(ds, &usb_process_ds);
btstack_run_loop_add_data_source(ds);
log_info("%u: %p fd: %u, events %x", r, pollfd[r], pollfd[r]->fd, pollfd[r]->events);
}

View File

@ -85,7 +85,7 @@ static int h4_open(void){
hci_transport_h4->ds = (btstack_data_source_t*) malloc(sizeof(btstack_data_source_t));
if (!hci_transport_h4->ds) return -1;
hci_transport_h4->ds->fd = fd;
hci_transport_h4->ds->process = h4_process;
btstack_run_loop_set_data_source_handler(hci_transport_h4->ds, &h4_process);
btstack_run_loop_add_data_source(hci_transport_h4->ds);
return 0;
}