@@ -871,6 +871,7 @@ pub(crate) mod tests {
871
871
. remote_addr ( remote_addr)
872
872
. build ( ) ;
873
873
let msg = Message :: new_request ( BINDING ) ;
874
+ let transaction_id = msg. transaction_id ( ) ;
874
875
let transmit = agent. send ( msg, remote_addr) . unwrap ( ) ;
875
876
let now = Instant :: now ( ) ;
876
877
assert_eq ! ( transmit. transport, TransportType :: Udp ) ;
@@ -881,6 +882,8 @@ pub(crate) mod tests {
881
882
let resp_data = response. to_bytes ( ) ;
882
883
let ret = agent. handle_incoming_data ( & resp_data, remote_addr) . unwrap ( ) ;
883
884
assert ! ( matches!( ret[ 0 ] , HandleStunReply :: StunResponse ( _, _) ) ) ;
885
+ assert ! ( agent. request_transaction( transaction_id) . is_none( ) ) ;
886
+ assert ! ( agent. mut_request_transaction( transaction_id) . is_none( ) ) ;
884
887
885
888
let ret = agent. poll ( now) ;
886
889
assert ! ( matches!( ret, StunAgentPollRet :: WaitUntil ( _) ) ) ;
@@ -904,6 +907,8 @@ pub(crate) mod tests {
904
907
assert_eq ! ( transmit. from, local_addr) ;
905
908
assert_eq ! ( transmit. to, remote_addr) ;
906
909
let _indication = Message :: from_bytes ( & transmit. data ) . unwrap ( ) ;
910
+ assert ! ( agent. request_transaction( transaction_id) . is_none( ) ) ;
911
+ assert ! ( agent. mut_request_transaction( transaction_id) . is_none( ) ) ;
907
912
// you should definitely never do this ;). Indications should never get replies.
908
913
let response = Message :: new (
909
914
MessageType :: from_class_method ( MessageClass :: Error , BINDING ) ,
@@ -960,6 +965,8 @@ pub(crate) mod tests {
960
965
961
966
assert_eq ! ( request. transaction_id( ) , transaction_id) ;
962
967
assert_eq ! ( response. transaction_id( ) , transaction_id) ;
968
+ assert ! ( agent. request_transaction( transaction_id) . is_none( ) ) ;
969
+ assert ! ( agent. mut_request_transaction( transaction_id) . is_none( ) ) ;
963
970
964
971
let data = vec ! [ 20 ; 4 ] ;
965
972
let mut replies = agent. handle_incoming_data ( & data, remote_addr) . unwrap ( ) ;
@@ -978,6 +985,7 @@ pub(crate) mod tests {
978
985
. remote_addr ( remote_addr)
979
986
. build ( ) ;
980
987
let msg = Message :: new_request ( BINDING ) ;
988
+ let transaction_id = msg. transaction_id ( ) ;
981
989
agent. send ( msg, remote_addr) . unwrap ( ) ;
982
990
let mut now = Instant :: now ( ) ;
983
991
loop {
@@ -990,6 +998,8 @@ pub(crate) mod tests {
990
998
_ => unreachable ! ( ) ,
991
999
}
992
1000
}
1001
+ assert ! ( agent. request_transaction( transaction_id) . is_none( ) ) ;
1002
+ assert ! ( agent. mut_request_transaction( transaction_id) . is_none( ) ) ;
993
1003
994
1004
// unvalidated peer data should be dropped
995
1005
let data = vec ! [ 20 ; 4 ] ;
@@ -1011,6 +1021,7 @@ pub(crate) mod tests {
1011
1021
assert ! ( replies. is_empty( ) ) ;
1012
1022
1013
1023
let msg = Message :: new_request ( BINDING ) ;
1024
+ let transaction_id = msg. transaction_id ( ) ;
1014
1025
let transmit = agent. send ( msg, remote_addr) . unwrap ( ) ;
1015
1026
1016
1027
let request = Message :: from_bytes ( & transmit. data ) . unwrap ( ) ;
@@ -1028,6 +1039,8 @@ pub(crate) mod tests {
1028
1039
let reply = agent. handle_incoming_data ( & data, to) . unwrap ( ) ;
1029
1040
1030
1041
assert ! ( matches!( reply[ 0 ] , HandleStunReply :: StunResponse ( _, _) ) ) ;
1042
+ assert ! ( agent. request_transaction( transaction_id) . is_none( ) ) ;
1043
+ assert ! ( agent. mut_request_transaction( transaction_id) . is_none( ) ) ;
1031
1044
1032
1045
let data = vec ! [ 42 ; 8 ] ;
1033
1046
let transmit = agent. send_data ( & data, remote_addr) ;
@@ -1056,6 +1069,7 @@ pub(crate) mod tests {
1056
1069
agent. set_remote_credentials ( remote_credentials. clone ( ) . into ( ) ) ;
1057
1070
1058
1071
let mut msg = Message :: new_request ( BINDING ) ;
1072
+ let transaction_id = msg. transaction_id ( ) ;
1059
1073
msg. add_message_integrity ( & local_credentials. into ( ) , IntegrityAlgorithm :: Sha1 )
1060
1074
. unwrap ( ) ;
1061
1075
let transmit = agent. send ( msg, remote_addr) . unwrap ( ) ;
@@ -1075,6 +1089,8 @@ pub(crate) mod tests {
1075
1089
let reply = agent. handle_incoming_data ( & data, to) . unwrap ( ) ;
1076
1090
// reply is ignored as it does not have credentials
1077
1091
assert ! ( reply. is_empty( ) ) ;
1092
+ assert ! ( agent. request_transaction( transaction_id) . is_some( ) ) ;
1093
+ assert ! ( agent. mut_request_transaction( transaction_id) . is_some( ) ) ;
1078
1094
1079
1095
// unvalidated peer data should be dropped
1080
1096
let data = vec ! [ 20 ; 4 ] ;
@@ -1226,6 +1242,8 @@ pub(crate) mod tests {
1226
1242
unreachable ! ( ) ;
1227
1243
} ;
1228
1244
assert_eq ! ( request. transaction_id( ) , transaction_id) ;
1245
+ assert ! ( agent. request_transaction( transaction_id) . is_none( ) ) ;
1246
+ assert ! ( agent. mut_request_transaction( transaction_id) . is_none( ) ) ;
1229
1247
}
1230
1248
1231
1249
#[ test]
0 commit comments