Esempio n. 1
0
func TestLoginProc(t *testing.T) {
	sess := &Session{}
	sess.MQ = make(chan IPCObject, 100)
	sess.User = &User{Id: 1}
	LoginProc(sess)

	user_tbl.Set(sess.User)
	data_tbl.Set(estates.COLLECTION, sess.Estates)
	data_tbl.Set(samples.COLLECTION, sess.LatencySamples)
}
Esempio n. 2
0
func BenchmarkLoginProc(b *testing.B) {
	for i := 1; i <= b.N; i++ {
		sess := &Session{}
		sess.MQ = make(chan IPCObject, 10)
		sess.User = &User{Id: int32(i)}
		LoginProc(sess)
		user_tbl.Set(sess.User)
		data_tbl.Set(estates.COLLECTION, sess.Estates)
		data_tbl.Set(samples.COLLECTION, sess.LatencySamples)
	}
}
Esempio n. 3
0
//------------------------------------------------ flush all user data
func _flush(sess *Session) {
	user_tbl.Set(sess.User)
	if sess.Estates != nil {
		data_tbl.Set(estates.COLLECTION, sess.Estates)
	}

	if sess.Soldiers != nil {
		data_tbl.Set(soldiers.COLLECTION, sess.Soldiers)
	}

	if sess.Heroes != nil {
		data_tbl.Set(heroes.COLLECTION, sess.Heroes)
	}

	if sess.LatencySamples != nil {
		data_tbl.Set(samples.COLLECTION, sess.LatencySamples)
	}

	sess.LastFlushTime = time.Now().Unix()
	sess.OpCount = 0
}