Bug fixes
Fixed not setting output int to 0 to specify zero connections when returning connection IDs.
This commit is contained in:
parent
dbdade3b00
commit
62ac6e779f
2 changed files with 8 additions and 3 deletions
|
@ -1490,7 +1490,8 @@ void UDPC::Context::update_impl() {
|
||||||
ntohs(receivedData.sin6_port),
|
ntohs(receivedData.sin6_port),
|
||||||
", packet id = ", seqID,
|
", packet id = ", seqID,
|
||||||
", good mode = ", iter->second.flags.test(1) ? "yes" : "no",
|
", good mode = ", iter->second.flags.test(1) ? "yes" : "no",
|
||||||
isPing ? ", ping" : "");
|
isPing && !isConnect ? ", ping"
|
||||||
|
: (isPing && isConnect ? ", disc" : ""));
|
||||||
|
|
||||||
// check if is delete
|
// check if is delete
|
||||||
if(isConnect && isPing) {
|
if(isConnect && isPing) {
|
||||||
|
@ -2167,6 +2168,9 @@ UDPC_ConnectionId* UDPC_get_list_connected(UDPC_HContext ctx, unsigned int *size
|
||||||
std::lock_guard<std::mutex> lock(c->mutex);
|
std::lock_guard<std::mutex> lock(c->mutex);
|
||||||
|
|
||||||
if(c->conMap.empty()) {
|
if(c->conMap.empty()) {
|
||||||
|
if(size) {
|
||||||
|
*size = 0;
|
||||||
|
}
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
if(size) {
|
if(size) {
|
||||||
|
|
|
@ -308,11 +308,12 @@ int main(int argc, char **argv) {
|
||||||
UDPC_set_accept_new_connections(context, 0);
|
UDPC_set_accept_new_connections(context, 0);
|
||||||
|
|
||||||
puts("Dropping all connections...");
|
puts("Dropping all connections...");
|
||||||
UDPC_ConnectionId *ids = UDPC_get_list_connected(context, NULL);
|
UDPC_ConnectionId *ids = UDPC_get_list_connected(context, &temp);
|
||||||
UDPC_ConnectionId *current = ids;
|
UDPC_ConnectionId *current = ids;
|
||||||
while(current->scope_id != 0 && current->port != 0) {
|
while(temp > 0) {
|
||||||
UDPC_drop_connection(context, *current, 0);
|
UDPC_drop_connection(context, *current, 0);
|
||||||
++current;
|
++current;
|
||||||
|
--temp;
|
||||||
}
|
}
|
||||||
UDPC_free_list_connected(ids);
|
UDPC_free_list_connected(ids);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue