StreamManagement: Fix HashMap potentially being altered while being itterated

This commit is contained in:
fiaxh 2021-04-08 12:19:11 +02:00
parent a91cada4fb
commit aeeda76c92

View file

@ -179,11 +179,11 @@ public class Module : XmppStreamNegotiationModule, WriteNodeFunc {
var remove_nrs = new ArrayList<int>(); var remove_nrs = new ArrayList<int>();
foreach (int nr in in_flight_stanzas.keys) { foreach (int nr in in_flight_stanzas.keys) {
if (nr <= h) { if (nr <= h) {
in_flight_stanzas[nr].promise.set_value(null);
remove_nrs.add(nr); remove_nrs.add(nr);
} }
} }
foreach (int nr in remove_nrs) { foreach (int nr in remove_nrs) {
in_flight_stanzas[nr].promise.set_value(null);
in_flight_stanzas.unset(nr); in_flight_stanzas.unset(nr);
} }
} }