Skip to content

Commit

Permalink
fix minor bugs (#160)
Browse files Browse the repository at this point in the history
* Fix: Initial start fail due nil userList. And use latest userInfo for alterID.

* use latest nodeinfo

Co-authored-by: crackair <[email protected]>
  • Loading branch information
Septrum101 and crackair authored Apr 21, 2022
1 parent 422ba7d commit 4944703
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions service/controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,14 @@ func (c *Controller) Start() error {
if err != nil {
return err
}

err = c.addNewUser(userInfo, newNodeInfo)
if err != nil {
return err
}

//sync controller userList
c.userList = userInfo

// Add Limiter
if err := c.AddInboundLimiter(c.Tag, newNodeInfo.SpeedLimit, userInfo); err != nil {
log.Print(err)
Expand Down Expand Up @@ -333,9 +335,10 @@ func (c *Controller) addNewUser(userInfo *[]api.UserInfo, nodeInfo *api.NodeInfo
} else {
alterID := 0
if c.panelType == "V2board" {
alterID = (*c.userList)[0].AlterID
// use latest userInfo
alterID = (*userInfo)[0].AlterID
} else {
alterID = c.nodeInfo.AlterID
alterID = nodeInfo.AlterID
}
if alterID >= 0 && alterID < math.MaxUint16 {
users = c.buildVmessUser(userInfo, uint16(alterID))
Expand Down

0 comments on commit 4944703

Please sign in to comment.