look at the code if you want to know what i did
This commit is contained in:
+8
-9
@@ -60,13 +60,19 @@ type Conn struct {
|
||||
|
||||
func (c *Conn) StartConn() (err error) {
|
||||
c.RegisterCritical(c.OnTick)
|
||||
return c.Loop.Start()
|
||||
if c.state == proto_base.Play {
|
||||
c.ActivateReceiveRoutine()
|
||||
}
|
||||
err = c.Loop.StartLoop()
|
||||
c.Loop = event.NewLoop()
|
||||
return
|
||||
}
|
||||
|
||||
func (c *Conn) ReceiveJob() {
|
||||
ctx := c.Ctx
|
||||
for {
|
||||
select {
|
||||
case <-c.Ctx.Done():
|
||||
case <-ctx.Done():
|
||||
return
|
||||
default:
|
||||
packet, err := c.Receive()
|
||||
@@ -233,10 +239,3 @@ func (c *Conn) OnTick(_ event.Tick) (err error) {
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (c *Conn) Start() (err error) {
|
||||
if c.Loop == nil {
|
||||
c.Loop = &event.Loop{}
|
||||
}
|
||||
return c.Loop.Start()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user