@@ -131,12 +131,6 @@ func (c *pgCoord) ServeMultiAgent(id uuid.UUID) agpl.MultiAgentConn {
131
131
panic ("not implemented" ) // TODO: Implement
132
132
}
133
133
134
- func (* pgCoord ) ServeHTTPDebug (w http.ResponseWriter , _ * http.Request ) {
135
- // TODO(spikecurtis) I'd like to hold off implementing this until after the rest of this is code reviewed.
136
- w .WriteHeader (http .StatusOK )
137
- _ , _ = w .Write ([]byte ("Coder Enterprise PostgreSQL distributed tailnet coordinator" ))
138
- }
139
-
140
134
func (c * pgCoord ) Node (id uuid.UUID ) * agpl.Node {
141
135
// In production, we only ever get this request for an agent.
142
136
// We're going to directly query the database, since we would only have the agent mapping stored locally if we had
@@ -167,7 +161,7 @@ func (c *pgCoord) ServeClient(conn net.Conn, id uuid.UUID, agent uuid.UUID) erro
167
161
slog .Error (err ))
168
162
}
169
163
}()
170
- cIO := newConnIO (c .ctx , c .logger , c .bindings , conn , id , agent )
164
+ cIO := newConnIO (c .ctx , c .logger , c .bindings , conn , id , agent , "" )
171
165
if err := sendCtx (c .ctx , c .newConnections , cIO ); err != nil {
172
166
// can only be a context error, no need to log here.
173
167
return err
@@ -186,7 +180,7 @@ func (c *pgCoord) ServeAgent(conn net.Conn, id uuid.UUID, name string) error {
186
180
}
187
181
}()
188
182
logger := c .logger .With (slog .F ("name" , name ))
189
- cIO := newConnIO (c .ctx , logger , c .bindings , conn , uuid .Nil , id )
183
+ cIO := newConnIO (c .ctx , logger , c .bindings , conn , uuid .Nil , id , name )
190
184
if err := sendCtx (c .ctx , c .newConnections , cIO ); err != nil {
191
185
// can only be a context error, no need to log here.
192
186
return err
@@ -217,8 +211,12 @@ type connIO struct {
217
211
bindings chan <- binding
218
212
}
219
213
220
- func newConnIO (
221
- pCtx context.Context , logger slog.Logger , bindings chan <- binding , conn net.Conn , client , agent uuid.UUID ,
214
+ func newConnIO (pCtx context.Context ,
215
+ logger slog.Logger ,
216
+ bindings chan <- binding ,
217
+ conn net.Conn ,
218
+ client , agent uuid.UUID ,
219
+ name string ,
222
220
) * connIO {
223
221
ctx , cancel := context .WithCancel (pCtx )
224
222
id := agent
@@ -235,7 +233,7 @@ func newConnIO(
235
233
client : client ,
236
234
agent : agent ,
237
235
decoder : json .NewDecoder (conn ),
238
- updates : agpl .NewTrackedConn (ctx , cancel , conn , id , logger , 0 ),
236
+ updates : agpl .NewTrackedConn (ctx , cancel , conn , id , logger , name , 0 ),
239
237
bindings : bindings ,
240
238
}
241
239
go c .recvLoop ()
@@ -1291,3 +1289,9 @@ func (h *heartbeats) cleanup() {
1291
1289
}
1292
1290
h .logger .Debug (h .ctx , "cleaned up old coordinators" )
1293
1291
}
1292
+
1293
+ func (* pgCoord ) ServeHTTPDebug (w http.ResponseWriter , _ * http.Request ) {
1294
+ // TODO(spikecurtis) I'd like to hold off implementing this until after the rest of this is code reviewed.
1295
+ w .WriteHeader (http .StatusOK )
1296
+ _ , _ = w .Write ([]byte ("Coder Enterprise PostgreSQL distributed tailnet coordinator" ))
1297
+ }
0 commit comments