通用服务器架构
摘要:目前这套服务器架构如下: 1.每个服务器启动的时候都会向MasterServer 注册(上传自己的ip,port,servertype等) 2.MasterServer收到注册消息后广播该信息给连上它的所有服务器,同时给该连上的服务器发送所有服务器的列表 3.单点服务器收到列表后, 依据上面的 连接
阅读全文
泊爷带你学go -- 经典的继承与接口 简直吊炸天 !
摘要:package main import ( "fmt" ) type TeamBase struct { m_TeamId uint64 m_Rid uint32 m_RoomRule uint32 m_Players []uint64 } type TeamInt interface { Init() CreateTeam(accountId uint64,...
阅读全文
泊爷带你学go -- 反射的经典玩法
摘要:package main import ( "fmt" "reflect" ) type order struct { ordId int customerId int } func createQuery(q interface{}) { t := reflect.TypeOf(q) //----NB啊 if t.String() == "main.order" ...
阅读全文
泊爷带你学go -- redis连接池的操作
摘要:package main import ( "common" "fmt" "proto" "strconv" "time" "github.com/garyburd/redigo/redis" "github.com/gogo/protobuf/proto" ) type RedisHelper struct { redisClie...
阅读全文