From: Jinhyung Choi Date: Fri, 22 May 2015 06:10:27 +0000 (+0900) Subject: ecs: fixed socket creation failure with disabled network X-Git-Tag: Tizen_Studio_1.3_Release_p2.3.1~83^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6fd08259328fd85ee003e11d2b518d902964aefe;p=sdk%2Femulator%2Fqemu.git ecs: fixed socket creation failure with disabled network added ipv4 option as default for loopback. Without setting the ipv4 option, AF_UNSPEC is set and mismatched address type occurs occasionaly. To prevent an another socket error, the mutex initialization locates earlier than ecs socket creation. Change-Id: I1ae3570d612bcc25794b86768430d287b3ccce2e Signed-off-by: Jinhyung Choi --- diff --git a/tizen/src/ecs/ecs.c b/tizen/src/ecs/ecs.c index 8e1091c20c..b10523c67c 100644 --- a/tizen/src/ecs/ecs.c +++ b/tizen/src/ecs/ecs.c @@ -222,6 +222,7 @@ static void ecs_close(ECS_State *cs) { if (cs->alive_timer != NULL) { timer_del(cs->alive_timer); + timer_free(cs->alive_timer); cs->alive_timer = NULL; } @@ -677,6 +678,9 @@ static void* ecs_initialize(void* args) { INFO("ecs starts initializing.\n"); + qemu_mutex_init(&mutex_clilist); + qemu_mutex_init(&mutex_location_data); + opts = qemu_opts_create(qemu_find_opts(ECS_OPTS_NAME), ECS_OPTS_NAME, 1, &local_err); if (error_is_set(&local_err)) { qerror_report_err(local_err); @@ -685,12 +689,16 @@ static void* ecs_initialize(void* args) { } qemu_opt_set(opts, "host", HOST_LISTEN_ADDR); + qemu_opt_set_bool(opts, "ipv4", true); cs = g_malloc0(sizeof(ECS_State)); if (NULL == cs) { ERR("ECS_State allocation failed.\n"); return NULL; } + + cs->listen_fd = -1; + port = get_emul_ecs_port(); INFO("ecs port: %d\n", port); sprintf(host_port, "%d", port); @@ -714,9 +722,6 @@ static void* ecs_initialize(void* args) { current_ecs = cs; cs->ecs_running = 1; - qemu_mutex_init(&mutex_clilist); - qemu_mutex_init(&mutex_location_data); - TRACE("ecs_loop entered.\n"); while (cs->ecs_running) { ret = ecs_loop(cs);