Skip to content

Commit ec64da9

Browse files
committed
fix: increment registry count
1 parent 681beac commit ec64da9

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/conn.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,8 @@ static int acquire_registry(conn_mode_entry_t *entry, udp_socket_config_t *confi
104104
registry->agents_count = 0;
105105
memset(registry->agents, 0, INITIAL_REGISTRY_SIZE * sizeof(juice_agent_t *));
106106

107+
registry->port = config->port_begin;
108+
107109
mutex_init(&registry->mutex, MUTEX_RECURSIVE);
108110
mutex_lock(&registry->mutex);
109111

@@ -143,10 +145,9 @@ static int acquire_registry(conn_mode_entry_t *entry, udp_socket_config_t *confi
143145
memset(entry->registries + i, 0, (new_size - i) * sizeof(conn_registry_t *));
144146
}
145147

146-
registry->index = i;
147-
registry->port = config->port_begin;
148-
149148
entry->registries[i] = registry;
149+
registry->index = i;
150+
++entry->registries_count;
150151
} else {
151152
mutex_lock(&registry->mutex);
152153
}
@@ -161,6 +162,7 @@ static void release_registry(conn_mode_entry_t *entry, conn_registry_t *registry
161162
return;
162163

163164
// registry must be locked
165+
164166
if (registry->agents_count == 0 && registry->cb_mux_incoming == NULL) {
165167
JLOG_DEBUG("No connection left, destroying connections registry");
166168
mutex_unlock(&registry->mutex);

0 commit comments

Comments
 (0)