Skip to content

Commit

Permalink
Initialize server port in sspanel
Browse files Browse the repository at this point in the history
This commit initializes the server port in sspanel.go if the userListResponse is not empty. This adds a level of preventative measure to ensure port is not left uninitialized.
  • Loading branch information
Septrum101 committed Oct 28, 2023
1 parent 4d1ed21 commit d9971b2
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions api/sspanel/sspanel.go
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,11 @@ func (c *APIClient) ParseSSNodeResponse(nodeInfoResponse *NodeInfoResponse) (*ap
return nil, fmt.Errorf("unmarshal %s failed: %s", reflect.TypeOf(userListResponse), err)
}

// init server port
if len(*userListResponse) != 0 {
port = (*userListResponse)[0].Port
}

if c.SpeedLimit > 0 {
speedLimit = uint64((c.SpeedLimit * 1000000) / 8)
} else {
Expand Down

0 comments on commit d9971b2

Please sign in to comment.