Commit b4bd367f authored by AlexStocks's avatar AlexStocks Committed by watermelo

Imp: new udp session

parent 4d0b3662
......@@ -280,15 +280,23 @@ func (s *server) runTcpEventLoop(newSession NewSessionCallback) {
}
func (s *server) runUDPEventLoop(newSession NewSessionCallback) {
var (
ss Session
)
s.wg.Add(1)
go func() {
defer s.wg.Done()
var (
err error
conn *net.UDPConn
ss Session
)
ss = newUDPSession(s.pktListener.(*net.UDPConn), s)
if err := newSession(ss); err != nil {
panic(err.Error())
}
ss.(*session).run()
conn = s.pktListener.(*net.UDPConn)
ss = newUDPSession(conn, s)
if err = newSession(ss); err != nil {
conn.Close()
panic(err.Error())
}
ss.(*session).run()
}()
}
type wsHandler struct {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment