1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
//! Recovery policies for codec errors.
/// Recovery policies for codec errors.
///
/// Each policy defines how the framework responds to a codec error.
///
/// A hook selects a policy, but the connection loop records and applies the
/// policy that survives its fallbacks. It escalates the selection to
/// [`Self::Disconnect`] for end-of-file failures, for a non-disconnecting
/// policy that would discard a frame the decoder did not consume, and for a
/// [`Self::Drop`] beyond
/// [`RecoveryConfig::max_consecutive_drops`](crate::codec::RecoveryConfig::max_consecutive_drops).
/// The `wireframe_codec_errors_total` metric and the `on_error` callback both
/// report the applied policy.
///
/// # Default Behaviour
///
/// [`CodecError::default_recovery_policy`](crate::codec::CodecError::default_recovery_policy)
/// returns the recommended policy for each error type. Applications can
/// override this via [`RecoveryPolicyHook`](crate::codec::RecoveryPolicyHook).