Re-expose Operation State in generics.
This is the worst code I have ever written. I hate the way this changes everything. ugh.
parent: tbd commit: 90db3e2
1 | use ; |
2 | use |
3 | , |
4 | , | Instance
5 | , | ObjectBackend
6 | ; |
7 | use ; |
8 | use ; |
9 | use TcpStream; |
10 | use ; |
11 | |
12 | pub async |
13 | our_instance: Instance, |
14 | mut socket: , |
15 | runtime: GiteratedStack, |
16 | |
17 | loop |
18 | let message = socket.next .await; |
19 | |
20 | if message.is_none |
21 | // Keep an eye out for this, I dont see why we shouldn't end the connection |
22 | unreachable! |
23 | |
24 | |
25 | let message = message.unwrap; |
26 | |
27 | let payload = match message |
28 | Ok => |
29 | let payload = match message |
30 | => payload, | Binary
31 | => | Ping
32 | let _ = socket.send .await; |
33 | continue; |
34 | |
35 | => return, | Close
36 | _ => continue, |
37 | ; |
38 | |
39 | payload |
40 | |
41 | Err => |
42 | // Connection error |
43 | warn!; |
44 | |
45 | return; |
46 | |
47 | ; |
48 | |
49 | let payload = match |
50 | Ok => payload, |
51 | Err => |
52 | warn! |
53 | "A network payload deserialization failure has occurred: {:?}", |
54 | e |
55 | ; |
56 | |
57 | continue; |
58 | |
59 | ; |
60 | |
61 | let operation_state = StackOperationState |
62 | our_instance: our_instance.clone, |
63 | runtime: runtime.clone, |
64 | instance: None, |
65 | user: None, |
66 | ; |
67 | |
68 | let result = handle_client_message .await; |
69 | |
70 | // Grab operation errors so we can log them, they don't make it across the network |
71 | if let Err = &result |
72 | error!; |
73 | |
74 | |
75 | // Map error to the network variant |
76 | let result = result.map_err; |
77 | |
78 | socket |
79 | .send |
80 | .await |
81 | .expect; |
82 | |
83 | |
84 | |
85 | pub async |
86 | payload: AuthenticatedPayload, |
87 | operation_state: StackOperationState, |
88 | runtime: GiteratedStack, |
89 | |
90 | let mut networked_object = runtime |
91 | . |
92 | .await |
93 | .as_internal_error_with_context?; |
94 | |
95 | let networked_operation = new; |
96 | |
97 | networked_object |
98 | .request |
99 | .await |
100 | |
101 |