virtual bool init();
virtual bool exit();
+ virtual bool run() { return false; }
virtual void signal(int sig);
virtual void on_init() {}
static void destroy_web_helper_agent(CWebHelperAgent* agent);
};
-#endif // _WEB_HELPER_AGENT_H_
\ No newline at end of file
+#endif // _WEB_HELPER_AGENT_H_
*/
pss->valid = true;
- if (agent->initalized()) {
+ if (agent->initialized()) {
pss->need_init = true;
ecore_pipe_write(agent->get_message_pipe(), MESSAGE_LEFT, strlen(MESSAGE_LEFT));
}
pthread_mutex_init(&g_ws_query_mutex, NULL);
pthread_cond_init(&g_ws_query_condition, NULL);
- if (g_ws_server_context) {
- if (pthread_create(&g_ws_server_thread, NULL, &process_ws_server, NULL) != 0) {
- g_ws_server_thread = (pthread_t)NULL;
- ret = false;
- }
- } else {
- LOGE("Failed creating server context : %p", g_ws_server_context);
- ret = false;
- }
-
- on_init();
-
m_initialized = true;
- test_client_connection();
-
return ret;
}
return true;
}
+bool CWebHelperAgentWebSocket::run()
+{
+ if (!m_initialized) {
+ LOGE("Not initialized");
+ return false;
+ }
+
+ bool ret = false;
+ if (g_ws_server_context) {
+ if (pthread_create(&g_ws_server_thread, NULL, &process_ws_server, NULL) != 0) {
+ g_ws_server_thread = (pthread_t)NULL;
+ ret = false;
+
+ on_init();
+
+ test_client_connection();
+ }
+ } else {
+ LOGE("Failed creating server context : %p", g_ws_server_context);
+ ret = false;
+ }
+ return ret;
+}
+
void CWebHelperAgentWebSocket::signal(int sig)
{
force_exit = 1;
LOGD("name : %s\n", appid);
+#ifdef WEBSOCKET
+ if (g_websocket.initialized()) {
+ g_websocket.run();
+ }
+#endif
+
appcore_efl_main(appid, &argc, (char ***)&argv, &ops);
delete [] argv;