This is an automated email from the git hooks/post-receive script.
git pushed a commit to branch eolian/improvements
in repository efl.
View the commit online.
commit e9bcd056af160e81260bdc1625d6cb1a81f619a6
Author: [email protected] <[email protected]>
AuthorDate: Thu Oct 29 22:47:06 2026 -0600
ecore_con: net wrappers, SSL objects and IP addresses are construction only
Dialer_Simple and Server_Simple inner_class (and inner_server), the
Dialer_Ssl ssl_context, Socket_Ssl adopt (optional), the Ssl_Context
setup (now mandatory) with its certificates, private_keys, crls, cas
and default_paths_load, and Efl.Net.Ip_Address family, port, address
and sockaddr can not be changed once the object is in use.
They now say so with @construct_only and use the generated guard. The
"set once" logic of the IP address is replaced by it, while the
consistency checks during construction stay.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
---
src/lib/ecore_con/efl_net_dialer_simple.c | 1 -
src/lib/ecore_con/efl_net_dialer_simple.eo | 6 +-
src/lib/ecore_con/efl_net_dialer_ssl.c | 3 +-
src/lib/ecore_con/efl_net_dialer_ssl.eo | 6 +-
src/lib/ecore_con/efl_net_ip_address.c | 33 ----------
src/lib/ecore_con/efl_net_ip_address.eo | 21 +++---
src/lib/ecore_con/efl_net_server_simple.c | 2 -
src/lib/ecore_con/efl_net_server_simple.eo | 9 ++-
src/lib/ecore_con/efl_net_socket_ssl.c | 1 -
src/lib/ecore_con/efl_net_socket_ssl.eo | 7 +-
src/lib/ecore_con/efl_net_ssl_context.c | 8 +--
src/lib/ecore_con/efl_net_ssl_context.eo | 38 +++++------
.../ecore_con/ecore_con_test_efl_net_ip_address.c | 76 +++++++++-------------
13 files changed, 80 insertions(+), 131 deletions(-)
diff --git a/src/lib/ecore_con/efl_net_dialer_simple.c b/src/lib/ecore_con/efl_net_dialer_simple.c
index 111874e8df..921420fe79 100644
--- a/src/lib/ecore_con/efl_net_dialer_simple.c
+++ b/src/lib/ecore_con/efl_net_dialer_simple.c
@@ -334,7 +334,6 @@ _efl_net_dialer_simple_efl_io_buffered_stream_line_delimiter_get(const Eo *o, Ef
EOLIAN static void
_efl_net_dialer_simple_inner_class_set(Eo *o, Efl_Net_Dialer_Simple_Data *pd, const Efl_Class *klass)
{
- EINA_SAFETY_ON_TRUE_RETURN(efl_finalized_get(o));
EINA_SAFETY_ON_NULL_RETURN(klass);
pd->inner_class = klass;
DBG("%p inner_class=%p %s", o, klass, efl_class_name_get(klass));
diff --git a/src/lib/ecore_con/efl_net_dialer_simple.eo b/src/lib/ecore_con/efl_net_dialer_simple.eo
index c68048e417..c6e7bb665b 100644
--- a/src/lib/ecore_con/efl_net_dialer_simple.eo
+++ b/src/lib/ecore_con/efl_net_dialer_simple.eo
@@ -61,7 +61,7 @@ class @beta Efl.Net.Dialer_Simple extends Efl.Net.Socket_Simple implements Efl.N
}
}
set {
- [[Constructor-only property to define the class used to create the inner dialer.]]
+ [[Defines the class used to create the inner dialer.]]
values {
klass: const(Efl.Class); [[The class. Not $null.]]
}
@@ -69,6 +69,10 @@ class @beta Efl.Net.Dialer_Simple extends Efl.Net.Socket_Simple implements Efl.N
}
}
+ constructors {
+ .inner_class @optional @construct_only;
+ }
+
implements {
Efl.Object.finalize;
Efl.Object.invalidate;
diff --git a/src/lib/ecore_con/efl_net_dialer_ssl.c b/src/lib/ecore_con/efl_net_dialer_ssl.c
index efc9d8e34c..318cdded80 100644
--- a/src/lib/ecore_con/efl_net_dialer_ssl.c
+++ b/src/lib/ecore_con/efl_net_dialer_ssl.c
@@ -109,9 +109,8 @@ _efl_net_dialer_ssl_efl_object_invalidate(Eo *o, Efl_Net_Dialer_Ssl_Data *pd)
}
EOLIAN static void
-_efl_net_dialer_ssl_ssl_context_set(Eo *o, Efl_Net_Dialer_Ssl_Data *pd, Eo *ssl_ctx)
+_efl_net_dialer_ssl_ssl_context_set(Eo *o EINA_UNUSED, Efl_Net_Dialer_Ssl_Data *pd, Eo *ssl_ctx)
{
- EINA_SAFETY_ON_TRUE_RETURN(efl_finalized_get(o));
EINA_SAFETY_ON_FALSE_RETURN(efl_isa(ssl_ctx, EFL_NET_SSL_CONTEXT_CLASS));
if (pd->ssl_ctx == ssl_ctx) return;
diff --git a/src/lib/ecore_con/efl_net_dialer_ssl.eo b/src/lib/ecore_con/efl_net_dialer_ssl.eo
index 9bb7417231..3644cb893a 100644
--- a/src/lib/ecore_con/efl_net_dialer_ssl.eo
+++ b/src/lib/ecore_con/efl_net_dialer_ssl.eo
@@ -29,8 +29,6 @@ class @beta Efl.Net.Dialer_Ssl extends Efl.Net.Socket_Ssl implements Efl.Net.Dia
This specifies a shared context for all clients, with
certificate, private keys, CRL, CAs...
-
- It must be called before @Efl.Object.finalize!
]]
values {
ssl_context: Efl.Net.Ssl.Context; [[SSL context]]
@@ -62,6 +60,10 @@ class @beta Efl.Net.Dialer_Ssl extends Efl.Net.Socket_Ssl implements Efl.Net.Dia
/* Note: no cork as it doesn't make sense here for the wrapped connection */
}
+ constructors {
+ .ssl_context @optional @construct_only;
+ }
+
implements {
Efl.Object.constructor;
Efl.Object.finalize;
diff --git a/src/lib/ecore_con/efl_net_ip_address.c b/src/lib/ecore_con/efl_net_ip_address.c
index 4ee875e306..42ccf351d1 100644
--- a/src/lib/ecore_con/efl_net_ip_address.c
+++ b/src/lib/ecore_con/efl_net_ip_address.c
@@ -108,13 +108,6 @@ _efl_net_ip_address_port_set(Eo *o EINA_UNUSED, Efl_Net_Ip_Address_Data *pd, uin
else
pport = &pd->ipv4.sin_port;
- if (*pport == nport) return;
- if (*pport)
- {
- ERR("port already set to %hu, new %hu", eina_ntohs(*pport), port);
- return;
- }
-
*pport = nport;
}
@@ -136,7 +129,6 @@ EOLIAN static void
_efl_net_ip_address_address_set(Eo *o EINA_UNUSED, Efl_Net_Ip_Address_Data *pd, Eina_Slice address)
{
Eina_Rw_Slice rw_slice;
- size_t i;
EINA_SAFETY_ON_TRUE_RETURN(pd->addr.sa_family == 0);
@@ -145,31 +137,6 @@ _efl_net_ip_address_address_set(Eo *o EINA_UNUSED, Efl_Net_Ip_Address_Data *pd,
EINA_SAFETY_ON_TRUE_RETURN(rw_slice.len != address.len);
- if (eina_slice_compare(eina_rw_slice_slice_get(rw_slice), address) == 0)
- return;
-
- for (i = 0; i < rw_slice.len; i++)
- {
- if (rw_slice.bytes[i])
- {
- char old_str[INET6_ADDRSTRLEN] = "";
- char new_str[INET6_ADDRSTRLEN] = "";
-
- if (!inet_ntop(pd->addr.sa_family, rw_slice.mem, old_str, sizeof(old_str)))
- {
- old_str[0] = '?';
- old_str[1] = '\0';
- }
- if (!inet_ntop(pd->addr.sa_family, address.mem, new_str, sizeof(new_str)))
- {
- new_str[0] = '?';
- new_str[1] = '\0';
- }
- ERR("address already set to %s, new %s", old_str, new_str);
- return;
- }
- }
-
eina_rw_slice_copy(rw_slice, address);
}
diff --git a/src/lib/ecore_con/efl_net_ip_address.eo b/src/lib/ecore_con/efl_net_ip_address.eo
index f8895b7b62..8d393a43c5 100644
--- a/src/lib/ecore_con/efl_net_ip_address.eo
+++ b/src/lib/ecore_con/efl_net_ip_address.eo
@@ -128,10 +128,7 @@ class @beta Efl.Net.Ip_Address extends Efl.Object {
}
@property family {
- [[The address family, one of AF_INET6 or AF_INET.
-
- May only be set once. Afterwards the object does not change.
- ]]
+ [[The address family, one of AF_INET6 or AF_INET.]]
values {
family: int; [[AF_INET or AF_INET6]]
}
@@ -140,8 +137,6 @@ class @beta Efl.Net.Ip_Address extends Efl.Object {
@property port {
[[The address port in Host/Native endianess.
- May only be set once. Afterwards the object does not change.
-
Must be set after @.family.
]]
values {
@@ -152,8 +147,6 @@ class @beta Efl.Net.Ip_Address extends Efl.Object {
@property address {
[[The bytes representing the address.
- May only be set once. Afterwards the object does not change.
-
Must be set after @.family.
]]
values {
@@ -162,10 +155,7 @@ class @beta Efl.Net.Ip_Address extends Efl.Object {
}
@property sockaddr {
- [[The <netinet/in.h>-compatible 'struct sockaddr'.
-
- May only be set once. Afterwards the object does not change.
- ]]
+ [[The <netinet/in.h>-compatible 'struct sockaddr'.]]
values {
sockaddr: const(void_ptr); [[Sockaddr struct. As usual with struct sockaddr, the first field, struct sockaddr::sa_family, defines the rest of the structure and how the whole structure must be interpreted. If AF_INET is struct sockaddr_in, AF_INET6 is struct sockaddr_in6.]]
}
@@ -235,6 +225,13 @@ class @beta Efl.Net.Ip_Address extends Efl.Object {
}
}
+ constructors {
+ .family @optional @construct_only;
+ .port @optional @construct_only;
+ .address @optional @construct_only;
+ .sockaddr @optional @construct_only;
+ }
+
implements {
Efl.Object.finalize;
}
diff --git a/src/lib/ecore_con/efl_net_server_simple.c b/src/lib/ecore_con/efl_net_server_simple.c
index 6ae83dd233..7cc4e5d64b 100644
--- a/src/lib/ecore_con/efl_net_server_simple.c
+++ b/src/lib/ecore_con/efl_net_server_simple.c
@@ -210,7 +210,6 @@ _efl_net_server_simple_efl_net_server_serving_get(const Eo *o EINA_UNUSED, Efl_N
EOLIAN static void
_efl_net_server_simple_inner_class_set(Eo *o, Efl_Net_Server_Simple_Data *pd, const Efl_Class *klass)
{
- EINA_SAFETY_ON_TRUE_RETURN(efl_finalized_get(o));
EINA_SAFETY_ON_NULL_RETURN(klass);
pd->inner_class = klass;
DBG("%p inner_class=%p %s", o, klass, efl_class_name_get(klass));
@@ -225,7 +224,6 @@ _efl_net_server_simple_inner_class_get(const Eo *o EINA_UNUSED, Efl_Net_Server_S
EOLIAN static void
_efl_net_server_simple_inner_server_set(Eo *o, Efl_Net_Server_Simple_Data *pd, Efl_Object *server)
{
- EINA_SAFETY_ON_TRUE_RETURN(efl_finalized_get(o));
EINA_SAFETY_ON_NULL_RETURN(server);
EINA_SAFETY_ON_TRUE_RETURN(pd->inner_server != NULL);
EINA_SAFETY_ON_FALSE_RETURN(efl_isa(server, EFL_NET_SERVER_INTERFACE));
diff --git a/src/lib/ecore_con/efl_net_server_simple.eo b/src/lib/ecore_con/efl_net_server_simple.eo
index 0a2b22f1f7..d08d852bb5 100644
--- a/src/lib/ecore_con/efl_net_server_simple.eo
+++ b/src/lib/ecore_con/efl_net_server_simple.eo
@@ -23,7 +23,7 @@ class @beta Efl.Net.Server_Simple extends Efl.Loop_Consumer implements Efl.Net.S
}
}
set {
- [[Constructor-only property to define the class used to create the inner dialer.]]
+ [[Defines the class used to create the inner dialer.]]
values {
klass: const(Efl.Class); [[The class. Not $null.]]
}
@@ -40,7 +40,7 @@ class @beta Efl.Net.Server_Simple extends Efl.Loop_Consumer implements Efl.Net.S
}
}
set {
- [[Constructor-only property to set the inner_server.]]
+ [[Sets the inner_server.]]
values {
server: Efl.Object; [[The server instance. Not $null.]]
}
@@ -48,6 +48,11 @@ class @beta Efl.Net.Server_Simple extends Efl.Loop_Consumer implements Efl.Net.S
}
}
+ constructors {
+ .inner_class @optional @construct_only;
+ .inner_server @optional @construct_only;
+ }
+
implements {
Efl.Object.finalize;
Efl.Object.invalidate;
diff --git a/src/lib/ecore_con/efl_net_socket_ssl.c b/src/lib/ecore_con/efl_net_socket_ssl.c
index 835281e8f0..7d40f28400 100644
--- a/src/lib/ecore_con/efl_net_socket_ssl.c
+++ b/src/lib/ecore_con/efl_net_socket_ssl.c
@@ -270,7 +270,6 @@ _efl_net_socket_ssl_adopt(Eo *o, Efl_Net_Socket_Ssl_Data *pd, Efl_Net_Socket *so
EINA_SAFETY_ON_TRUE_RETURN(pd->sock != NULL);
EINA_SAFETY_ON_FALSE_RETURN(efl_isa(sock, EFL_NET_SOCKET_INTERFACE));
EINA_SAFETY_ON_FALSE_RETURN(efl_isa(context, EFL_NET_SSL_CONTEXT_CLASS));
- EINA_SAFETY_ON_TRUE_RETURN(efl_finalized_get(o));
is_dialer = efl_isa(sock, EFL_NET_DIALER_INTERFACE);
err = efl_net_ssl_conn_setup(&pd->ssl_conn, is_dialer, sock, context);
diff --git a/src/lib/ecore_con/efl_net_socket_ssl.eo b/src/lib/ecore_con/efl_net_socket_ssl.eo
index 78b4e3a182..da39e9971d 100644
--- a/src/lib/ecore_con/efl_net_socket_ssl.eo
+++ b/src/lib/ecore_con/efl_net_socket_ssl.eo
@@ -21,9 +21,6 @@ class @beta Efl.Net.Socket_Ssl extends Efl.Loop_Consumer implements Efl.Net.Sock
If used with an Efl.Net.Dialer object, it will assume
the 'connect' role, otherwise will use 'accept'.
-
- This is a constructor only method and should be called
- before @Efl.Object.finalize.
]]
params {
efl_net_socket: Efl.Net.Socket; [[The socket to adopt]]
@@ -80,6 +77,10 @@ class @beta Efl.Net.Socket_Ssl extends Efl.Loop_Consumer implements Efl.Net.Sock
}
}
+ constructors {
+ .adopt @optional @construct_only;
+ }
+
implements {
Efl.Object.constructor;
Efl.Object.finalize;
diff --git a/src/lib/ecore_con/efl_net_ssl_context.c b/src/lib/ecore_con/efl_net_ssl_context.c
index bbf1aec1e9..ff0b4e80e3 100644
--- a/src/lib/ecore_con/efl_net_ssl_context.c
+++ b/src/lib/ecore_con/efl_net_ssl_context.c
@@ -117,9 +117,8 @@ efl_net_ssl_context_connection_new(Efl_Net_Ssl_Context *context)
}
EOLIAN static void
-_efl_net_ssl_context_setup(Eo *o, Efl_Net_Ssl_Context_Data *pd, Efl_Net_Ssl_Cipher cipher, Eina_Bool is_dialer)
+_efl_net_ssl_context_setup(Eo *o EINA_UNUSED, Efl_Net_Ssl_Context_Data *pd, Efl_Net_Ssl_Cipher cipher, Eina_Bool is_dialer)
{
- EINA_SAFETY_ON_TRUE_RETURN(efl_finalized_get(o));
EINA_SAFETY_ON_TRUE_RETURN(cipher > EFL_NET_SSL_CIPHER_TLSV1_2);
pd->cipher = cipher;
@@ -157,7 +156,6 @@ _efl_net_ssl_context_certificates_get(const Eo *o EINA_UNUSED, Efl_Net_Ssl_Conte
static void
_efl_net_ssl_context_certificates_set(Eo *o EINA_UNUSED, Efl_Net_Ssl_Context_Data *pd, Eina_Iterator *it)
{
- EINA_SAFETY_ON_TRUE_RETURN(efl_finalized_get(o));
_efl_net_ssl_context_string_list_free(&pd->certificates);
pd->certificates = _efl_net_ssl_context_string_iter_to_list(it);
}
@@ -171,7 +169,6 @@ _efl_net_ssl_context_private_keys_get(const Eo *o EINA_UNUSED, Efl_Net_Ssl_Conte
static void
_efl_net_ssl_context_private_keys_set(Eo *o EINA_UNUSED, Efl_Net_Ssl_Context_Data *pd, Eina_Iterator *it)
{
- EINA_SAFETY_ON_TRUE_RETURN(efl_finalized_get(o));
_efl_net_ssl_context_string_list_free(&pd->private_keys);
pd->private_keys = _efl_net_ssl_context_string_iter_to_list(it);
}
@@ -185,7 +182,6 @@ _efl_net_ssl_context_certificate_revocation_lists_get(const Eo *o EINA_UNUSED, E
static void
_efl_net_ssl_context_certificate_revocation_lists_set(Eo *o EINA_UNUSED, Efl_Net_Ssl_Context_Data *pd, Eina_Iterator *it)
{
- EINA_SAFETY_ON_TRUE_RETURN(efl_finalized_get(o));
_efl_net_ssl_context_string_list_free(&pd->certificate_revocation_lists);
pd->certificate_revocation_lists = _efl_net_ssl_context_string_iter_to_list(it);
}
@@ -199,7 +195,6 @@ _efl_net_ssl_context_certificate_authorities_get(const Eo *o EINA_UNUSED, Efl_Ne
static void
_efl_net_ssl_context_certificate_authorities_set(Eo *o EINA_UNUSED, Efl_Net_Ssl_Context_Data *pd, Eina_Iterator *it)
{
- EINA_SAFETY_ON_TRUE_RETURN(efl_finalized_get(o));
_efl_net_ssl_context_string_list_free(&pd->certificate_authorities);
pd->certificate_authorities = _efl_net_ssl_context_string_iter_to_list(it);
}
@@ -213,7 +208,6 @@ _efl_net_ssl_context_default_paths_load_get(const Eo *o EINA_UNUSED, Efl_Net_Ssl
static void
_efl_net_ssl_context_default_paths_load_set(Eo *o EINA_UNUSED, Efl_Net_Ssl_Context_Data *pd, Eina_Bool load_defaults)
{
- EINA_SAFETY_ON_TRUE_RETURN(efl_finalized_get(o));
pd->load_defaults = load_defaults;
}
diff --git a/src/lib/ecore_con/efl_net_ssl_context.eo b/src/lib/ecore_con/efl_net_ssl_context.eo
index d4d4196219..601fd10e2b 100644
--- a/src/lib/ecore_con/efl_net_ssl_context.eo
+++ b/src/lib/ecore_con/efl_net_ssl_context.eo
@@ -11,7 +11,9 @@ class @beta Efl.Net.Ssl.Context extends Efl.Object {
@Efl.Object.finalize in order to define the mandatory
operational parameters.
- Note: All setter methods must be called before @Efl.Object.finalize.
+ Note: the setup, certificate, private key, CRL, CA and default
+ paths setters are only allowed during construction, before
+ @Efl.Object.finalize.
]]
methods {
@@ -41,50 +43,35 @@ class @beta Efl.Net.Ssl.Context extends Efl.Object {
}
@property certificates {
- [[The list of paths to certificates to use.
-
- Can only be set during object construction!
- ]]
+ [[The list of paths to certificates to use.]]
values {
paths: iterator<string> @move; [[Path list for certificates]]
}
}
@property private_keys {
- [[The list of paths to private keys to use.
-
- Can only be set during object construction!
- ]]
+ [[The list of paths to private keys to use.]]
values {
paths: iterator<string> @move; [[Path list for private keys]]
}
}
@property certificate_revocation_lists {
- [[The list of paths to CRL (certificate revocation list) to use.
-
- Can only be set during object construction!
- ]]
+ [[The list of paths to CRL (certificate revocation list) to use.]]
values {
paths: iterator<string> @move; [[Path list for CRL's]]
}
}
@property certificate_authorities {
- [[The list of paths to CA (certificate authoritie) to use.
-
- Can only be set during object construction!
- ]]
+ [[The list of paths to CA (certificate authoritie) to use.]]
values {
paths: iterator<string> @move; [[Path list for CA's]]
}
}
@property default_paths_load {
- [[If $true, will use system's default certificate storage
-
- Can only be set during object construction!
- ]]
+ [[If $true, will use system's default certificate storage.]]
values {
default_paths_load: bool; [[$if true use system default paths for loading, $false otherwise]]
}
@@ -127,6 +114,15 @@ class @beta Efl.Net.Ssl.Context extends Efl.Object {
}
}
+ constructors {
+ .setup @construct_only;
+ .certificates @optional @construct_only;
+ .private_keys @optional @construct_only;
+ .certificate_revocation_lists @optional @construct_only;
+ .certificate_authorities @optional @construct_only;
+ .default_paths_load @optional @construct_only;
+ }
+
implements {
Efl.Object.constructor;
Efl.Object.destructor;
diff --git a/src/tests/ecore_con/ecore_con_test_efl_net_ip_address.c b/src/tests/ecore_con/ecore_con_test_efl_net_ip_address.c
index 4a1724ce0b..a22422b31b 100644
--- a/src/tests/ecore_con/ecore_con_test_efl_net_ip_address.c
+++ b/src/tests/ecore_con/ecore_con_test_efl_net_ip_address.c
@@ -366,29 +366,23 @@ EFL_START_TEST(ecore_test_efl_net_ip_address_ipv4_manual_fail)
efl_net_ip_address_set(efl_added, slice));
_ipv4_check(o, &addr);
- TRAP_ERRORS_BEGIN(ecore_con, ERR, "port already set to %hu, new %hu");
- efl_net_ip_address_port_set(o, eina_ntohs(addr.sin_port));
- TRAP_ERRORS_FINISH(0);
+ /* construction only: every set after efl_add is refused, even with the
+ * value it already has, and nothing changes */
+ {
+ struct sockaddr_in other = { .sin_family = AF_INET };
+ Eina_Slice other_slice = { .mem = &other.sin_addr, .len = sizeof(other.sin_addr) };
- TRAP_ERRORS_BEGIN(ecore_con, ERR, "port already set to %hu, new %hu");
- efl_net_ip_address_port_set(o, 999);
- TRAP_ERRORS_FINISH(1);
-
- TRAP_ERRORS_BEGIN(eina_safety, ERR, "safety check failed: rw_slice.len != address.len is true");
- slice.len = 1;
- efl_net_ip_address_set(o, slice);
- TRAP_ERRORS_FINISH(1);
-
- TRAP_ERRORS_BEGIN(ecore_con, ERR, "address already set to %s, new %s");
- slice.len = sizeof(addr.sin_addr.s_addr);
- efl_net_ip_address_set(o, slice);
- TRAP_ERRORS_FINISH(0);
-
- TRAP_ERRORS_BEGIN(ecore_con, ERR, "address already set to %s, new %s");
- addr.sin_addr.s_addr = eina_htonl(0x12345678);
- slice.len = sizeof(addr.sin_addr.s_addr);
- efl_net_ip_address_set(o, slice);
- TRAP_ERRORS_FINISH(1);
+ other.sin_addr.s_addr = eina_htonl(0x12345678);
+ TRAP_ERRORS_BEGIN(eo, ERR, NULL);
+ efl_net_ip_address_family_set(o, AF_INET);
+ efl_net_ip_address_port_set(o, eina_ntohs(addr.sin_port));
+ efl_net_ip_address_port_set(o, 999);
+ efl_net_ip_address_set(o, slice);
+ efl_net_ip_address_set(o, other_slice);
+ efl_net_ip_address_sockaddr_set(o, &other);
+ TRAP_ERRORS_FINISH(6);
+ }
+ _ipv4_check(o, &addr);
efl_unref(o);
}
@@ -762,29 +756,23 @@ EFL_START_TEST(ecore_test_efl_net_ip_address_ipv6_manual_fail)
efl_net_ip_address_set(efl_added, slice));
_ipv6_check(o, &addr);
- TRAP_ERRORS_BEGIN(ecore_con, ERR, "port already set to %hu, new %hu");
- efl_net_ip_address_port_set(o, eina_ntohs(addr.sin6_port));
- TRAP_ERRORS_FINISH(0);
+ /* construction only: every set after efl_add is refused, even with the
+ * value it already has, and nothing changes */
+ {
+ struct sockaddr_in6 other = { .sin6_family = AF_INET6 };
+ Eina_Slice other_slice = { .mem = &other.sin6_addr, .len = sizeof(other.sin6_addr) };
- TRAP_ERRORS_BEGIN(ecore_con, ERR, "port already set to %hu, new %hu");
- efl_net_ip_address_port_set(o, 999);
- TRAP_ERRORS_FINISH(1);
-
- TRAP_ERRORS_BEGIN(eina_safety, ERR, "safety check failed: rw_slice.len != address.len is true");
- slice.len = 1;
- efl_net_ip_address_set(o, slice);
- TRAP_ERRORS_FINISH(1);
-
- TRAP_ERRORS_BEGIN(ecore_con, ERR, "address already set to %s, new %s");
- slice.len = sizeof(addr.sin6_addr);
- efl_net_ip_address_set(o, slice);
- TRAP_ERRORS_FINISH(0);
-
- TRAP_ERRORS_BEGIN(ecore_con, ERR, "address already set to %s, new %s");
- _ipv6_set(&addr, 1, 2, 3, 4, 5, 6, 7, 8);
- slice.len = sizeof(addr.sin6_addr);
- efl_net_ip_address_set(o, slice);
- TRAP_ERRORS_FINISH(1);
+ _ipv6_set(&other, 1, 2, 3, 4, 5, 6, 7, 8);
+ TRAP_ERRORS_BEGIN(eo, ERR, NULL);
+ efl_net_ip_address_family_set(o, AF_INET6);
+ efl_net_ip_address_port_set(o, eina_ntohs(addr.sin6_port));
+ efl_net_ip_address_port_set(o, 999);
+ efl_net_ip_address_set(o, slice);
+ efl_net_ip_address_set(o, other_slice);
+ efl_net_ip_address_sockaddr_set(o, &other);
+ TRAP_ERRORS_FINISH(6);
+ }
+ _ipv6_check(o, &addr);
efl_unref(o);
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.