You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficcontrol.apache.org by el...@apache.org on 2018/06/08 21:05:06 UTC

[incubator-trafficcontrol] branch master updated: Fix TM nil panic

This is an automated email from the ASF dual-hosted git repository.

elsloo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-trafficcontrol.git


The following commit(s) were added to refs/heads/master by this push:
     new ddb2cce  Fix TM nil panic
ddb2cce is described below

commit ddb2cce0d221929bc6f7ab18429d6fd2ee7954cc
Author: Robert Butts <ro...@apache.org>
AuthorDate: Wed Jun 6 12:18:22 2018 -0600

    Fix TM nil panic
---
 traffic_monitor/towrap/towrap.go | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/traffic_monitor/towrap/towrap.go b/traffic_monitor/towrap/towrap.go
index bad18a3..04163d5 100644
--- a/traffic_monitor/towrap/towrap.go
+++ b/traffic_monitor/towrap/towrap.go
@@ -106,7 +106,10 @@ func (h CRConfigHistoryThreadsafe) Add(i *CRConfigStat) {
 
 	if *h.len != 0 {
 		last := (*h.hist)[(*h.pos-1)%*h.limit]
-		if i.ReqAddr == last.ReqAddr && *i.Stats.DateUnixSeconds == *last.Stats.DateUnixSeconds && *i.Stats.CDNName == *last.Stats.CDNName {
+		datesEqual := (i.Stats.DateUnixSeconds == nil && last.Stats.DateUnixSeconds == nil) || (i.Stats.DateUnixSeconds != nil && last.Stats.DateUnixSeconds != nil && *i.Stats.DateUnixSeconds == *last.Stats.DateUnixSeconds)
+		cdnsEqual := (i.Stats.CDNName == nil && last.Stats.CDNName == nil) || (i.Stats.CDNName != nil && last.Stats.CDNName != nil && *i.Stats.CDNName == *last.Stats.CDNName)
+		reqAddrsEqual := i.ReqAddr == last.ReqAddr
+		if reqAddrsEqual && datesEqual && cdnsEqual {
 			return
 		}
 	}

-- 
To stop receiving notification emails like this one, please contact
elsloo@apache.org.