Changes
parent: tbd commit: 0b2a26d
1 | use ; |
2 | |
3 | use ; |
4 | use |
5 | , | AuthenticationTokenGranter
6 | , |
7 | connection, listener, |
8 | ; |
9 | use Listeners; |
10 | use ; |
11 | use |
12 | , | File
13 | , |
14 | , |
15 | , | Mutex
16 | ; |
17 | use ; |
18 | use Table; |
19 | |
20 | |
21 | extern crate tracing; |
22 | |
23 | |
24 | async |
25 | ; | init
26 | let mut listener = bind .await?; |
27 | let connections: = default; |
28 | let listeners: = default; |
29 | let config: Table = |
30 | let mut file = open .await?; |
31 | let mut text = String new; |
32 | file.read_to_string .await?; |
33 | text.parse? |
34 | ; |
35 | let db_conn_options = new |
36 | .host |
37 | .port |
38 | .database |
39 | .username |
40 | .password |
41 | .log_statements |
42 | .to_owned; |
43 | let db_pool = connect_with .await?; |
44 | |
45 | let repository_backend: = new |
46 | let foo: GitBackend = GitBackend |
47 | pg_pool: db_pool, |
48 | repository_folder: String from, |
49 | ; |
50 | foo |
51 | ; |
52 | |
53 | let token_granter = new |
54 | config: config.clone, |
55 | ; |
56 | |
57 | loop |
58 | let stream = accept_stream .await; |
59 | |
60 | let = match stream |
61 | Ok => stream, |
62 | Err => |
63 | error!; |
64 | continue; |
65 | |
66 | ; |
67 | |
68 | info!; |
69 | |
70 | let connection = accept_websocket_connection .await; |
71 | |
72 | let connection = match connection |
73 | Ok => connection, |
74 | Err => |
75 | error! |
76 | "Failed to initiate Websocket connection from {}. {:?}", |
77 | address, err |
78 | ; |
79 | continue; |
80 | |
81 | ; |
82 | |
83 | info!; |
84 | |
85 | let connection = RawConnection |
86 | task: spawn |
87 | connection, |
88 | listeners.clone, |
89 | connections.clone, |
90 | repository_backend.clone, |
91 | token_granter.clone, |
92 | address, |
93 | , |
94 | ; |
95 | |
96 | connections.lock .await.connections.push; |
97 | |
98 | |
99 | |
100 | async |
101 | listener: &mut TcpListener, |
102 | |
103 | let stream = listener.accept .await?; |
104 | |
105 | Ok |
106 | |
107 | |
108 | async |
109 | stream: S, |
110 | |
111 | let connection = accept_async .await?; |
112 | |
113 | Ok |
114 | |
115 |