Add total amount of branches after filter
parent: tbd commit: c29b3b8
1 | use ; |
2 | use |
3 | , |
4 | , | Instance
5 | , | ObjectBackend
6 | , | User
7 | ; |
8 | use ; |
9 | use ; |
10 | use TcpStream; |
11 | use ; |
12 | |
13 | pub async |
14 | our_instance: Instance, |
15 | mut socket: , |
16 | runtime: GiteratedStack, |
17 | |
18 | loop |
19 | let message = socket.next .await; |
20 | |
21 | if message.is_none |
22 | // Keep an eye out for this, I dont see why we shouldn't end the connection |
23 | unreachable! |
24 | |
25 | |
26 | let message = message.unwrap; |
27 | |
28 | let payload = match message |
29 | Ok => |
30 | let payload = match message |
31 | => payload, | Binary
32 | => | Ping
33 | let _ = socket.send .await; |
34 | continue; |
35 | |
36 | => return, | Close
37 | _ => continue, |
38 | ; |
39 | |
40 | payload |
41 | |
42 | Err => |
43 | // Connection error |
44 | warn!; |
45 | |
46 | return; |
47 | |
48 | ; |
49 | |
50 | trace!; |
51 | |
52 | let payload = match |
53 | Ok => payload, |
54 | Err => |
55 | warn! |
56 | "A network payload deserialization failure has occurred: {:?}", |
57 | e |
58 | ; |
59 | |
60 | continue; |
61 | |
62 | ; |
63 | |
64 | trace! |
65 | "Deserialized payload for operation {} from client", |
66 | payload.operation |
67 | ; |
68 | |
69 | let operation_state = StackOperationState |
70 | our_instance: our_instance.clone, |
71 | runtime: runtime.clone, |
72 | instance: None, |
73 | user: Some |
74 | username: "uwu".to_string, |
75 | instance: Instance, |
76 | , |
77 | ; |
78 | |
79 | let result = handle_client_message .await; |
80 | |
81 | // Grab operation errors so we can log them, they don't make it across the network |
82 | if let Err = &result |
83 | error!; |
84 | |
85 | |
86 | // Map error to the network variant |
87 | let result = result.map_err; |
88 | |
89 | socket |
90 | .send |
91 | .await |
92 | .expect; |
93 | |
94 | |
95 | |
96 | pub async |
97 | payload: AuthenticatedPayload, |
98 | operation_state: StackOperationState, |
99 | runtime: GiteratedStack, |
100 | |
101 | let mut networked_object = runtime |
102 | . |
103 | .await |
104 | .as_internal_error_with_context?; |
105 | |
106 | let message: GiteratedMessage = |
107 | payload.into_message; |
108 | |
109 | let networked_operation = new |
110 | message.payload.name.clone, |
111 | message.payload.payload.clone, |
112 | ; |
113 | |
114 | trace!; |
115 | |
116 | networked_object |
117 | .request |
118 | .await |
119 | |
120 |