summaryrefslogtreecommitdiff
path: root/src/lib/ecore_con
diff options
context:
space:
mode:
authorCedric BAIL <cedric@osg.samsung.com>2018-05-01 16:18:53 -0700
committerCedric BAIL <cedric@osg.samsung.com>2018-05-24 16:02:18 -0700
commit7ca25cae0f6cccc6969c5969ed04877bbff6a993 (patch)
treea75db60c49a1b700f8bd7f31bcfdc9ec1d7bbf00 /src/lib/ecore_con
parent56fb2cf377fabe5429be6d1abbfe1f7b35ccb320 (diff)
ecore: correct lifecycle of object used by Ecore_Con legacy.
Differential Revision: https://phab.enlightenment.org/D6080
Diffstat (limited to 'src/lib/ecore_con')
-rw-r--r--src/lib/ecore_con/ecore_con_legacy.c51
1 files changed, 26 insertions, 25 deletions
diff --git a/src/lib/ecore_con/ecore_con_legacy.c b/src/lib/ecore_con/ecore_con_legacy.c
index fdb4994c30..f5643bbc00 100644
--- a/src/lib/ecore_con/ecore_con_legacy.c
+++ b/src/lib/ecore_con/ecore_con_legacy.c
@@ -977,6 +977,14 @@ _ecore_con_server_free(Ecore_Con_Server *svr)
977 977
978 _ecore_con_server_dialer_close(svr); 978 _ecore_con_server_dialer_close(svr);
979 979
980 if (svr->ssl.clients_ctx)
981 {
982 // This is always created with efl_add_ref
983 efl_parent_set(svr->ssl.clients_ctx, NULL);
984 efl_unref(svr->ssl.clients_ctx);
985 svr->ssl.clients_ctx = NULL;
986 }
987
980 if (svr->dialer) 988 if (svr->dialer)
981 { 989 {
982 efl_del(svr->dialer); 990 efl_del(svr->dialer);
@@ -989,12 +997,6 @@ _ecore_con_server_free(Ecore_Con_Server *svr)
989 svr->server = NULL; 997 svr->server = NULL;
990 } 998 }
991 999
992 if (svr->ssl.clients_ctx)
993 {
994 efl_unref(svr->ssl.clients_ctx);
995 svr->ssl.clients_ctx = NULL;
996 }
997
998 if (svr->ssl.job) eina_future_cancel(svr->ssl.job); 1000 if (svr->ssl.job) eina_future_cancel(svr->ssl.job);
999 1001
1000 if (svr->ssl.pending_send) 1002 if (svr->ssl.pending_send)
@@ -1591,13 +1593,13 @@ _ecore_con_server_ssl_ctx_create(const Ecore_Con_Server *svr)
1591 1593
1592 /* legacy compatibility: server never verified peer, only dialer did */ 1594 /* legacy compatibility: server never verified peer, only dialer did */
1593 1595
1594 return efl_add(EFL_NET_SSL_CONTEXT_CLASS, efl_main_loop_get(), 1596 return efl_add_ref(EFL_NET_SSL_CONTEXT_CLASS, efl_main_loop_get(),
1595 efl_net_ssl_context_certificates_set(efl_added, eina_list_iterator_new(svr->ssl.certs)), 1597 efl_net_ssl_context_certificates_set(efl_added, eina_list_iterator_new(svr->ssl.certs)),
1596 efl_net_ssl_context_private_keys_set(efl_added, eina_list_iterator_new(svr->ssl.privkeys)), 1598 efl_net_ssl_context_private_keys_set(efl_added, eina_list_iterator_new(svr->ssl.privkeys)),
1597 efl_net_ssl_context_certificate_revocation_lists_set(efl_added, eina_list_iterator_new(svr->ssl.crls)), 1599 efl_net_ssl_context_certificate_revocation_lists_set(efl_added, eina_list_iterator_new(svr->ssl.crls)),
1598 efl_net_ssl_context_certificate_authorities_set(efl_added, eina_list_iterator_new(svr->ssl.cafiles)), 1600 efl_net_ssl_context_certificate_authorities_set(efl_added, eina_list_iterator_new(svr->ssl.cafiles)),
1599 efl_net_ssl_context_default_paths_load_set(efl_added, EINA_FALSE), /* old API didn't load default paths */ 1601 efl_net_ssl_context_default_paths_load_set(efl_added, EINA_FALSE), /* old API didn't load default paths */
1600 efl_net_ssl_context_setup(efl_added, cipher, EINA_FALSE)); 1602 efl_net_ssl_context_setup(efl_added, cipher, EINA_FALSE));
1601} 1603}
1602 1604
1603static Eina_Value 1605static Eina_Value
@@ -1990,8 +1992,7 @@ _ecore_con_server_dialer_ssl_job(void *data, const Eina_Value v,
1990 EINA_SAFETY_ON_NULL_GOTO(dialer, error_dialer); 1992 EINA_SAFETY_ON_NULL_GOTO(dialer, error_dialer);
1991 1993
1992 efl_parent_set(inner_dialer, dialer); 1994 efl_parent_set(inner_dialer, dialer);
1993 1995 efl_parent_set(ssl_ctx, inner_dialer);
1994 efl_unref(ssl_ctx); /* inner_dialer keeps it */
1995 1996
1996 if (!_ecore_con_server_dialer_set(svr, dialer)) 1997 if (!_ecore_con_server_dialer_set(svr, dialer))
1997 goto error_dial; 1998 goto error_dial;
@@ -2062,16 +2063,16 @@ _ecore_con_server_dialer_ssl_upgrade_job(void *data, const Eina_Value v,
2062 if (svr->ssl.verify) 2063 if (svr->ssl.verify)
2063 verify_mode = EFL_NET_SSL_VERIFY_MODE_REQUIRED; 2064 verify_mode = EFL_NET_SSL_VERIFY_MODE_REQUIRED;
2064 2065
2065 ssl_ctx = efl_add(EFL_NET_SSL_CONTEXT_CLASS, efl_main_loop_get(), 2066 ssl_ctx = efl_add_ref(EFL_NET_SSL_CONTEXT_CLASS, efl_main_loop_get(),
2066 efl_net_ssl_context_certificates_set(efl_added, eina_list_iterator_new(svr->ssl.certs)), 2067 efl_net_ssl_context_certificates_set(efl_added, eina_list_iterator_new(svr->ssl.certs)),
2067 efl_net_ssl_context_private_keys_set(efl_added, eina_list_iterator_new(svr->ssl.privkeys)), 2068 efl_net_ssl_context_private_keys_set(efl_added, eina_list_iterator_new(svr->ssl.privkeys)),
2068 efl_net_ssl_context_certificate_revocation_lists_set(efl_added, eina_list_iterator_new(svr->ssl.crls)), 2069 efl_net_ssl_context_certificate_revocation_lists_set(efl_added, eina_list_iterator_new(svr->ssl.crls)),
2069 efl_net_ssl_context_certificate_authorities_set(efl_added, eina_list_iterator_new(svr->ssl.cafiles)), 2070 efl_net_ssl_context_certificate_authorities_set(efl_added, eina_list_iterator_new(svr->ssl.cafiles)),
2070 efl_net_ssl_context_verify_mode_set(efl_added, verify_mode), 2071 efl_net_ssl_context_verify_mode_set(efl_added, verify_mode),
2071 efl_net_ssl_context_hostname_set(efl_added, svr->ssl.verify_name ? svr->ssl.verify_name : svr->name), 2072 efl_net_ssl_context_hostname_set(efl_added, svr->ssl.verify_name ? svr->ssl.verify_name : svr->name),
2072 efl_net_ssl_context_hostname_verify_set(efl_added, svr->ssl.verify_basic), 2073 efl_net_ssl_context_hostname_verify_set(efl_added, svr->ssl.verify_basic),
2073 efl_net_ssl_context_default_paths_load_set(efl_added, EINA_FALSE), /* old API didn't load default paths */ 2074 efl_net_ssl_context_default_paths_load_set(efl_added, EINA_FALSE), /* old API didn't load default paths */
2074 efl_net_ssl_context_setup(efl_added, cipher, EINA_TRUE)); 2075 efl_net_ssl_context_setup(efl_added, cipher, EINA_TRUE));
2075 EINA_SAFETY_ON_NULL_GOTO(ssl_ctx, error_ssl_ctx); 2076 EINA_SAFETY_ON_NULL_GOTO(ssl_ctx, error_ssl_ctx);
2076 2077
2077 tcp_dialer = svr->dialer; 2078 tcp_dialer = svr->dialer;