-option('version', type: 'string', value: '0.0.0', description: 'ESPP service version')
-option('sock-path', type: 'string', value: '/tmp/espp_service.socket', description: 'ESPP service socket path')
+option('version', type: 'string', value: '0.3.1', description: 'ESPP service version')
+option('sock-path', type: 'string', value: '/tmp/espp_service.sock', description: 'ESPP service socket path')
option('dlog', type: 'boolean', value: true, description: 'Use dlog')
option('service-app', type: 'boolean', value: false, description: 'Daemon is launched as Tizen service app')
#include <sys/socket.h>
#include <sys/un.h>
#include <pthread.h>
+#ifdef USE_SERVICE_APP
+#include <service_app.h>
+#endif
#define EXIT_IF_NEEDED(x_rx_data) \
do { \
{
bool event_mode = false;
handler_userdata_s *hdata = (handler_userdata_s *)data;
+ espp_service_s *svc;
+ guint num_of_clients;
ASSERT(hdata);
ASSERT(hdata->fd != -1);
+ svc = hdata->svc;
+
LOG_WARNING("entrance, fd[%d]", hdata->fd);
while (1) {
}
exit:
- LOG_WARNING("exit, fd[%d]", hdata->fd);
+ num_of_clients = g_hash_table_size(hdata->svc->fd_table);
+ LOG_WARNING("exit, fd[%d], svc[%p], num_of_clients[%u] remain", hdata->fd, svc, num_of_clients);
close(hdata->fd);
g_free(hdata);
+#ifdef USE_SERVICE_APP
+ if (num_of_clients == 0) {
+ LOG_ERROR("no more clients, service exits now...");
+ service_app_exit();
+ }
+#endif
pthread_exit(NULL);
}