mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-04-17 20:42:47 +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: bt_close crashes when used in CocoaTouch app
|
||||||
- BUG: BTdaemon crashes on iPhone when CocoaTouch app is closed (sometimes)
|
- BUG: BTdaemon crashes on iPhone when CocoaTouch app is closed (sometimes)
|
||||||
- BUG: malloc warning when BTdaemon is started by launchd
|
- 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
|
- Provide BTstackManager Objective-C class
|
||||||
- implement l2cap code
|
- implement l2cap code
|
||||||
- implement rfcomm code
|
- implement rfcomm code
|
||||||
|
@ -344,13 +344,16 @@ int main (int argc, char * const * argv){
|
|||||||
l2cap_register_event_packet_handler(daemon_event_handler);
|
l2cap_register_event_packet_handler(daemon_event_handler);
|
||||||
timeout.process = daemon_no_connections_timeout;
|
timeout.process = daemon_no_connections_timeout;
|
||||||
|
|
||||||
|
#ifdef USE_LAUNCHD
|
||||||
|
socket_connection_create_launchd();
|
||||||
|
#else
|
||||||
// create server
|
// create server
|
||||||
if (tcp_flag) {
|
if (tcp_flag) {
|
||||||
socket_connection_create_tcp(BTSTACK_PORT);
|
socket_connection_create_tcp(BTSTACK_PORT);
|
||||||
} else {
|
} else {
|
||||||
socket_connection_create_unix(BTSTACK_UNIX);
|
socket_connection_create_unix(BTSTACK_UNIX);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
socket_connection_register_packet_callback(daemon_client_handler);
|
socket_connection_register_packet_callback(daemon_client_handler);
|
||||||
|
|
||||||
// handle CTRL-c
|
// handle CTRL-c
|
||||||
|
@ -270,11 +270,10 @@ int socket_connection_create_tcp(int port){
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* create socket data_source for unix domain socket
|
* create socket data_source for socket specified by launchd configuration
|
||||||
* */
|
*/
|
||||||
int socket_connection_create_unix(char *path){
|
|
||||||
|
|
||||||
#ifdef USE_LAUNCHD
|
#ifdef USE_LAUNCHD
|
||||||
|
int socket_connection_create_launchd(){
|
||||||
|
|
||||||
launch_data_t sockets_dict, checkin_response;
|
launch_data_t sockets_dict, checkin_response;
|
||||||
launch_data_t checkin_request;
|
launch_data_t checkin_request;
|
||||||
@ -348,8 +347,13 @@ int socket_connection_create_unix(char *path){
|
|||||||
}
|
}
|
||||||
|
|
||||||
launch_data_free(checkin_response);
|
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
|
// create data_source_t
|
||||||
data_source_t *ds = malloc( sizeof(data_source_t));
|
data_source_t *ds = malloc( sizeof(data_source_t));
|
||||||
@ -389,8 +393,6 @@ int socket_connection_create_unix(char *path){
|
|||||||
|
|
||||||
run_loop_add_data_source(ds);
|
run_loop_add_data_source(ds);
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
printf ("Server up and running ...\n");
|
printf ("Server up and running ...\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -45,6 +45,11 @@
|
|||||||
/** opaque connection type */
|
/** opaque connection type */
|
||||||
typedef struct connection connection_t;
|
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
|
* create socket for incoming tcp connections
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user