mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-03-21 04:21:03 +00:00
extract socket_connection_create_launchd from unix part
This commit is contained in:
parent
0f1a967503
commit
46acae3723
1
TODO.txt
1
TODO.txt
@ -7,6 +7,7 @@ NEXT:
|
||||
- BUG: bt_close crashes when used in CocoaTouch app
|
||||
- BUG: BTdaemon crashes on iPhone when CocoaTouch app is closed (sometimes)
|
||||
- BUG: malloc warning when BTdaemon is started by launchd
|
||||
- Support TCP socket server on 13333 via launchd in addition to the unix socket
|
||||
- Provide BTstackManager Objective-C class
|
||||
- implement l2cap code
|
||||
- implement rfcomm code
|
||||
|
@ -343,14 +343,17 @@ int main (int argc, char * const * argv){
|
||||
l2cap_init();
|
||||
l2cap_register_event_packet_handler(daemon_event_handler);
|
||||
timeout.process = daemon_no_connections_timeout;
|
||||
|
||||
|
||||
#ifdef USE_LAUNCHD
|
||||
socket_connection_create_launchd();
|
||||
#else
|
||||
// create server
|
||||
if (tcp_flag) {
|
||||
socket_connection_create_tcp(BTSTACK_PORT);
|
||||
} else {
|
||||
socket_connection_create_unix(BTSTACK_UNIX);
|
||||
}
|
||||
|
||||
#endif
|
||||
socket_connection_register_packet_callback(daemon_client_handler);
|
||||
|
||||
// handle CTRL-c
|
||||
|
@ -270,11 +270,10 @@ int socket_connection_create_tcp(int port){
|
||||
}
|
||||
|
||||
/**
|
||||
* create socket data_source for unix domain socket
|
||||
* */
|
||||
int socket_connection_create_unix(char *path){
|
||||
|
||||
* create socket data_source for socket specified by launchd configuration
|
||||
*/
|
||||
#ifdef USE_LAUNCHD
|
||||
int socket_connection_create_launchd(){
|
||||
|
||||
launch_data_t sockets_dict, checkin_response;
|
||||
launch_data_t checkin_request;
|
||||
@ -348,9 +347,14 @@ int socket_connection_create_unix(char *path){
|
||||
}
|
||||
|
||||
launch_data_free(checkin_response);
|
||||
}
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
/**
|
||||
* create socket data_source for unix domain socket
|
||||
*/
|
||||
int socket_connection_create_unix(char *path){
|
||||
|
||||
// create data_source_t
|
||||
data_source_t *ds = malloc( sizeof(data_source_t));
|
||||
if (ds == NULL) return -1;
|
||||
@ -389,8 +393,6 @@ int socket_connection_create_unix(char *path){
|
||||
|
||||
run_loop_add_data_source(ds);
|
||||
|
||||
#endif
|
||||
|
||||
printf ("Server up and running ...\n");
|
||||
return 0;
|
||||
}
|
||||
|
@ -45,6 +45,11 @@
|
||||
/** opaque connection type */
|
||||
typedef struct connection connection_t;
|
||||
|
||||
/**
|
||||
* create socket data_source for socket specified by launchd configuration
|
||||
*/
|
||||
int socket_connection_create_launchd();
|
||||
|
||||
/**
|
||||
* create socket for incoming tcp connections
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user