#define MAX_EVENTS 10
#define MAX_READ_LEN 1024
-extern int interrupt_flag;
+int interrupt_flag;
static int epollfd = 0;
static FILE *log_file = NULL;
static void _stop_message_timer(vine_dp_h dp);
static int joined_peer = 0;
+#ifdef USE_VINE_EVENT_LOOP_EXTERNAL_GLIB
+static GMainLoop *main_loop = NULL;
+#endif
+
static vine_dp_type_e _convert_dp_type(dp_type_t type)
{
switch (type) {
vine_session_process_event(session);
}
-#ifdef BT_SUPPORT
+#ifdef USE_VINE_EVENT_LOOP_EXTERNAL_GLIB
static void _run_glib_event_loop()
{
- GMainLoop *main_loop = g_main_loop_new(NULL, FALSE);
+ main_loop = g_main_loop_new(NULL, FALSE);
g_main_loop_run(main_loop);
g_main_loop_unref(main_loop);
}
#endif
+
+void stop_event_loop()
+{
+#ifdef USE_VINE_EVENT_LOOP_EXTERNAL_GLIB
+ if (main_loop)
+ g_main_loop_quit(main_loop);
+#else
+ interrupt_flag = 1;
+#endif
+}
+
static void _run_epoll_event_loop(vine_session_h session)
{
int fd;