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