Skip to content

Commit

Permalink
tidb-server: Address comment
Browse files Browse the repository at this point in the history
  • Loading branch information
shenli committed Sep 24, 2015
1 parent 7090091 commit 2762c4f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion tidb-server/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ func (s *Server) releaseToken(token *Token) {
// See: https://github.com/mysql/mysql-server/blob/5.7/mysys_ssl/crypt_genhash_impl.cc#L435
func randomBuf(size int) []byte {
buf := make([]byte, size)
rand.Seed(time.Now().UTC().UnixNano())
for i := 0; i < size; i++ {
buf[i] = byte(rand.Intn(127))
if buf[i] == 0 || buf[i] == byte('$') {
Expand Down Expand Up @@ -112,6 +111,8 @@ func NewServer(cfg *Config, driver IDriver) (*Server, error) {
return nil, errors.Trace(err)
}

// Init rand seed for randomBuf()
rand.Seed(time.Now().UTC().UnixNano())
log.Infof("Server run MySql Protocol Listen at [%s]", s.cfg.Addr)
return s, nil
}
Expand Down

0 comments on commit 2762c4f

Please sign in to comment.