Skip to content

Commit 799742a

Browse files
clamattiakartben
authored andcommitted
net: sockets_service: Always clear old events when registering
Clear all previous events when register is called a second time. This is the same behavior as before, if the call happens with `len` equal or greater then the previous call but in the case if `len` is less then the first call, now, all events are cleared. This is more predictable behavior. Signed-off-by: Cla Mattia Galliard <cla-mattia.galliard@zuehlke.com>
1 parent e234473 commit 799742a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

subsys/net/lib/sockets/sockets_service.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,9 @@ int z_impl_net_socket_service_register(const struct net_socket_service_desc *svc
7171
goto out;
7272
}
7373

74-
if (fds == NULL) {
75-
cleanup_svc_events(svc);
76-
} else {
74+
cleanup_svc_events(svc);
75+
76+
if (fds != NULL) {
7777
if (len > svc->pev_len) {
7878
NET_DBG("Too many file descriptors, "
7979
"max is %d for service %p",

0 commit comments

Comments
 (0)