Skip to content

Commit 4e7e594

Browse files
committed
Update server.go
1 parent b21b091 commit 4e7e594

File tree

1 file changed

+9
-17
lines changed

1 file changed

+9
-17
lines changed

dagger-server/internal/cmd/server.go

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -142,31 +142,23 @@ func websocketReqMethod(c *gin.Context) {
142142
username := BytesToString(v.GetStringBytes("username"))
143143
password := BytesToString(v.GetStringBytes("password"))
144144

145-
log.Infof("process[%s]:%d", link, runtime.NumGoroutine())
145+
log.Infof("P[%s]:%d", link, runtime.NumGoroutine())
146146
startTime := time.Now()
147147
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) {
156149
info := fmt.Sprintf("user[%s]:password[%s] acl fail", username, password)
157150
log.Errorf(info)
158151
ws.WriteMessage(mt, []byte(info))
152+
break
159153
}
154+
}
160155

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())
161160
} 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())
170162
}
171163
break
172164
}

0 commit comments

Comments
 (0)