Skip to content
Permalink
Browse files
Imp: new udp session
  • Loading branch information
AlexStocks authored and watermelo committed Jul 18, 2020
1 parent 4d0b366 commit b4bd367fdf0b4ad369e47b60e3b3f1c182ad227d
Showing 1 changed file with 16 additions and 8 deletions.
@@ -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 {

0 comments on commit b4bd367

Please sign in to comment.