You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@trafficcontrol.apache.org by GitBox <gi...@apache.org> on 2022/04/14 20:22:49 UTC

[GitHub] [trafficcontrol] rob05c commented on a diff in pull request #6756: Fix t3c TO API fallback

rob05c commented on code in PR #6756:
URL: https://github.com/apache/trafficcontrol/pull/6756#discussion_r850777407


##########
cache-config/t3cutil/toreq/client.go:
##########
@@ -48,8 +48,22 @@ import (
 )
 
 type TOClient struct {
-	c          *toclient.Session
-	old        *toreqold.TOClient
+	// c is the "new" Traffic Ops client, for the latest major API.
+	//
+	// This MUST NOT be accessed without checking for nil.
+	// If the Traffic Ops server doesn't support the latest API, it will fall back,
+	// and c will be nil and old will not, and old must be used.
+	//
+	// **WARNING** This MUST NOT be accessed without checking for nil. See above.
+	c *toclient.Session

Review Comment:
   This is something of a footgun. This being the second panic we've had recently. It'd be really nice to make it impossible to happen, but that'd require quite a bit of abstraction, it'd be a lot of code. So for now, I added some giant warning comments on the symbol. If it happens again, we can reconsider if the abstraction to make it impossible is worth it.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@trafficcontrol.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org