Skip to content

Commit 489aca4

Browse files
committed
Update comments
1 parent f1d9986 commit 489aca4

File tree

51 files changed

+314
-365
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+314
-365
lines changed

bfe_balance/backend/health_check.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ func checkHTTPConnect(backend *BfeBackend, checkConf *cluster_conf.BackendCheck)
180180
return cluster_conf.MatchStatusCode(statusCode, *checkConf.StatusCode)
181181
}
182182

183-
// CheckRedirect check whether backend server become available.
183+
// CheckConnect checks whether backend server become available.
184184
func CheckConnect(backend *BfeBackend, checkConf *cluster_conf.BackendCheck) (bool, error) {
185185
switch *checkConf.Schem {
186186
case "http":

bfe_balance/bal_table.go

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -125,12 +125,11 @@ func (t *BalTable) gslbInit(gslbConfs gslb_conf.GslbConf) error {
125125
t.versions.GslbConfTimeStamp = *gslbConfs.Ts
126126
t.versions.GslbConfSrc = *gslbConfs.Hostname
127127

128-
if len(fails) == 0 {
129-
return nil
130-
} else {
128+
if len(fails) != 0 {
131129
return fmt.Errorf("error in ClusterTable.gslbInit() for [%s]",
132130
strings.Join(fails, ","))
133131
}
132+
return nil
134133
}
135134

136135
func (t *BalTable) backendInit(backendConfs cluster_table_conf.ClusterTableConf) error {
@@ -159,12 +158,11 @@ func (t *BalTable) backendInit(backendConfs cluster_table_conf.ClusterTableConf)
159158
// update versions
160159
t.versions.ClusterTableConfVer = *backendConfs.Version
161160

162-
if len(fails) == 0 {
163-
return nil
164-
} else {
161+
if len(fails) != 0 {
165162
return fmt.Errorf("error in ClusterTable.backendInit() for [%s]",
166163
strings.Join(fails, ","))
167164
}
165+
return nil
168166
}
169167

170168
// SetGslbBasic sets gslb basic conf (from server data conf) for BalTable.
@@ -244,11 +242,10 @@ func (t *BalTable) BalTableReload(gslbConfs gslb_conf.GslbConf,
244242

245243
t.lock.Unlock()
246244

247-
if len(fails) == 0 {
248-
return nil
249-
} else {
245+
if len(fails) != 0 {
250246
return fmt.Errorf("error in BalTableReload() for [%s]", strings.Join(fails, ","))
251247
}
248+
return nil
252249
}
253250

254251
func (t *BalTable) lookup(clusterName string) (*bal_gslb.BalanceGslb, error) {

bfe_basic/action/action.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ type Action struct {
6262
Params []string // params of action
6363
}
6464

65-
// UnmarshalJson decodes given data in json format
65+
// UnmarshalJSON decodes given data in json format
6666
func (ac *Action) UnmarshalJSON(data []byte) error {
6767
var actionFile ActionFile
6868

bfe_basic/action/action_query.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ func ReqQueryRename(req *bfe_basic.Request, oldName string, newName string) {
115115
req.HttpRequest.URL.RawQuery = rawQuery[1:]
116116
}
117117

118-
// ReqQueryRename deletes some keys from query
118+
// ReqQueryDel deletes some keys from query
119119
func ReqQueryDel(req *bfe_basic.Request, keys []string) {
120120
// add "&" prefix and suffix to simplify process
121121
rawQuery := "&" + req.HttpRequest.URL.RawQuery + "&"

bfe_basic/common.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ func CreateInternalSrvErrResp(request *Request) *bfe_http.Response {
4747
return CreateInternalResp(request, bfe_http.StatusInternalServerError)
4848
}
4949

50-
// CreateInternalSrvErrResp returns a HTTP 403 response
50+
// CreateForbiddenResp returns a HTTP 403 response
5151
func CreateForbiddenResp(request *Request) *bfe_http.Response {
5252
return CreateInternalResp(request, bfe_http.StatusForbidden)
5353
}

bfe_basic/condition/parser/walk.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
package parser
1818

19-
// A Visitor's Visit method is invoked for each node encountered by Walk.
19+
// Visitor wraps the Visit method which is invoked for each node encountered by Walk.
2020
// If the result visitor w is not nil, Walk visits each of the children
2121
// of node with the visitor w, followed by a call of w.Visit(nil).
2222
type Visitor interface {

bfe_basic/request.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,8 @@ func (req *Request) SetRequestTransport(backend *backend.BfeBackend,
156156
func (req *Request) Protocol() string {
157157
if req.Session.IsSecure {
158158
return req.Session.Proto
159-
} else {
160-
return req.HttpRequest.Proto
161159
}
160+
return req.HttpRequest.Proto
162161
}
163162

164163
func (r *Request) AddTags(name string, ntags []string) {

bfe_config/bfe_cluster_conf/cluster_conf/cluster_conf_load.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ type HashConf struct {
9090
SessionSticky *bool
9191
}
9292

93-
// Cluster conf for Gslb
93+
// GslbBasicConf is basic conf for Gslb
9494
type GslbBasicConf struct {
9595
CrossRetry *int // retry cross sub clusters
9696
RetryMax *int // inner cluster retry
@@ -111,7 +111,7 @@ type ClusterBasicConf struct {
111111
CancelOnClientClose *bool // cancel blocking operation on server if client connection disconnected
112112
}
113113

114-
// ClusterBasicConf is conf of cluster.
114+
// ClusterConf is conf of cluster.
115115
type ClusterConf struct {
116116
BackendConf *BackendBasic // backend's basic conf
117117
CheckConf *BackendCheck // how to check backend
@@ -222,7 +222,7 @@ func MatchStatusCode(statusCodeGet int, statusCodeExpect int) (bool, error) {
222222
statusCodeGet, convertStatusCode(statusCodeExpect))
223223
}
224224

225-
// BackendBasicCheck check BackendCheck config.
225+
// BackendCheckCheck check BackendCheck config.
226226
func BackendCheckCheck(conf *BackendCheck) error {
227227
if conf.Schem == nil {
228228
// set default schem to http
@@ -337,7 +337,7 @@ func HashConfCheck(conf *HashConf) error {
337337
return nil
338338
}
339339

340-
// ClusterToConf check ClusterBasicConf.
340+
// ClusterBasicConfCheck check ClusterBasicConf.
341341
func ClusterBasicConfCheck(conf *ClusterBasicConf) error {
342342
if conf.TimeoutReadClientAgain == nil ||
343343
conf.TimeoutReadClient == nil ||
@@ -365,7 +365,7 @@ func ClusterBasicConfCheck(conf *ClusterBasicConf) error {
365365
return nil
366366
}
367367

368-
// ClusterBasicConfCheck check ClusterConf.
368+
// ClusterConfCheck check ClusterConf.
369369
func ClusterConfCheck(conf *ClusterConf) error {
370370
var err error
371371

bfe_config/bfe_route_conf/route_rule_conf/route_table_load.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ type RouteRuleFile struct {
4242
type RouteRules []RouteRule
4343
type RouteRuleFiles []RouteRuleFile
4444

45-
// ProductRule holds mapping from product to rules.
45+
// ProductRouteRule holds mapping from product to rules.
4646
type ProductRouteRule map[string]RouteRules
4747
type ProductRouteRuleFile map[string]RouteRuleFiles
4848

bfe_config/bfe_tls_conf/session_ticket_key_conf/session_ticket_key_conf.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ const (
3131
RAW_SESSION_TICKET_KEY_SIZE = 48 // bytes
3232
)
3333

34-
// config for session ticket key
34+
// SessionTicketKeyConf is session ticket key config.
3535
type SessionTicketKeyConf struct {
3636
Version string // version of config
3737
SessionTicketKey string // session ticket key (hex encode)

0 commit comments

Comments
 (0)