mirror of
https://github.com/CPunch/gopenfusion.git
synced 2025-10-11 03:40:06 +00:00
CNPeer/Service refactor
- each CNPeer is given a unique chan *protocol.Event to pass events to the service.handleEvents() loop. this is now passed to CNPeer.Handler() as opposed to NewCNPeer(). - service has basically been rewritten. handleEvents() main loop uses reflect.SelectCase() now to handle all of the eRecv channels for each peer - new protocol Event type: EVENT_CLIENT_CONNECT - Added service_test.go; blackbox-styled testing like the others. TestService() starts a service and spins up a bunch of dummy peers and verifies that each packet sent causes the corresponding packet handler to be called.
This commit is contained in:
@@ -19,10 +19,7 @@ type ShardServer struct {
|
||||
}
|
||||
|
||||
func NewShardServer(dbHndlr *db.DBHandler, redisHndlr *redis.RedisHandler, port int) (*ShardServer, error) {
|
||||
srvc, err := service.NewService("SHARD", port)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
srvc := service.NewService("SHARD", port)
|
||||
|
||||
server := &ShardServer{
|
||||
service: srvc,
|
||||
|
Reference in New Issue
Block a user