@@ -142,31 +142,23 @@ func websocketReqMethod(c *gin.Context) {
142
142
username := BytesToString (v .GetStringBytes ("username" ))
143
143
password := BytesToString (v .GetStringBytes ("password" ))
144
144
145
- log .Infof ("process [%s]:%d" , link , runtime .NumGoroutine ())
145
+ log .Infof ("P [%s]:%d" , link , runtime .NumGoroutine ())
146
146
startTime := time .Now ()
147
147
if conf .User .Enable {
148
- if db .UserAclCheck (username , password ) {
149
- b := process (c , ws , link )
150
- if b {
151
- log .Infof ("process[%s][login-done]:%d" , link , runtime .NumGoroutine ())
152
- } else {
153
- log .Errorf ("process[%s][fali]:%d" , link , runtime .NumGoroutine ())
154
- }
155
- } else {
148
+ if ! db .UserAclCheck (username , password ) {
156
149
info := fmt .Sprintf ("user[%s]:password[%s] acl fail" , username , password )
157
150
log .Errorf (info )
158
151
ws .WriteMessage (mt , []byte (info ))
152
+ break
159
153
}
154
+ }
160
155
156
+ b := process (c , ws , link )
157
+ tcTime := time .Since (startTime )
158
+ if b {
159
+ log .Infof ("P[%s][done][%v]:%d" , link , tcTime , runtime .NumGoroutine ())
161
160
} else {
162
- b := process (c , ws , link )
163
- tcTime := time .Since (startTime )
164
- fmt .Printf ("time cost = %v\n " , tcTime )
165
- if b {
166
- log .Infof ("process[%s][done][%v]:%d" , link , tcTime , runtime .NumGoroutine ())
167
- } else {
168
- log .Errorf ("process[%s][fali]:%d" , link , runtime .NumGoroutine ())
169
- }
161
+ log .Errorf ("P[%s][fali]:%d" , link , runtime .NumGoroutine ())
170
162
}
171
163
break
172
164
}
0 commit comments