Commit 146985f
authored
fix: reduce references to Server in codex-login crate (#2398)
Updates the tokio task that monitors `shutdown_notify` and server
requests to ensure that `server.unblock()` is always called, which means
that `ShutdownHandle` only has to invoke `notify_waiters()`.
Now `LoginServer` no longer has to maintain a reference to `Server`. The
`Arc<Server>` only has two active references: the `thread::spawn()` for
reading server messages and the `tokio::task()` that consumes them (and
the shutdown message). Now when shutdown is called (or if login
completes successfully), the `server.unblock()` call ensures the thread
terminates cleanly, which in turn ensures `rx.recv()` in the
`tokio::spawn()` returns `Err`, causing the `tokio::task()` to exit
cleanly, as well.
---
[//]: # (BEGIN SAPLING FOOTER)
Stack created with [Sapling](https://sapling-scm.com). Best reviewed
with [ReviewStack](https://reviewstack.dev/openai/codex/pull/2398).
* #2399
* __->__ #2398
* #2396
* #2395
* #2394
* #2393
* #23891 parent d5b42ba commit 146985f
1 file changed
+12
-22
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
69 | | - | |
| 69 | + | |
70 | 70 | | |
71 | 71 | | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | 72 | | |
82 | 73 | | |
83 | 74 | | |
84 | 75 | | |
85 | 76 | | |
86 | | - | |
87 | 77 | | |
88 | 78 | | |
89 | 79 | | |
| |||
133 | 123 | | |
134 | 124 | | |
135 | 125 | | |
136 | | - | |
| 126 | + | |
137 | 127 | | |
138 | 128 | | |
139 | | - | |
| 129 | + | |
140 | 130 | | |
141 | 131 | | |
142 | 132 | | |
143 | | - | |
| 133 | + | |
144 | 134 | | |
145 | 135 | | |
146 | 136 | | |
| |||
159 | 149 | | |
160 | 150 | | |
161 | 151 | | |
162 | | - | |
163 | | - | |
164 | | - | |
| 152 | + | |
165 | 153 | | |
166 | 154 | | |
167 | 155 | | |
168 | | - | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
169 | 162 | | |
170 | 163 | | |
171 | 164 | | |
172 | 165 | | |
173 | 166 | | |
174 | 167 | | |
175 | 168 | | |
176 | | - | |
177 | | - | |
178 | | - | |
179 | | - | |
| 169 | + | |
180 | 170 | | |
181 | 171 | | |
182 | 172 | | |
| |||
0 commit comments