pull/12/head
q191201771 2 years ago
parent 4104b05e22
commit 082fd2299c

@ -42,6 +42,7 @@ var defaultOption = UdpConnectionOption{
AllocEachRead: true,
}
// TODO(chef): [opt] 增加函数,可以返回内部的本地地址 202208
type UdpConnection struct {
option UdpConnectionOption
ruaddr *net.UDPAddr
@ -74,6 +75,8 @@ func NewUdpConnection(modOptions ...ModUdpConnectionOption) (*UdpConnection, err
//
// @return error: 如果外部调用Dispose会返回error
//
// 注意回调存在err!=nil(*net.OpError, Err={error | poll.errNetClosing} use of closed network connection), len==0的情况
//
func (c *UdpConnection) RunLoop(onRead OnReadUdpPacket) error {
var b []byte
if !c.option.AllocEachRead {

Loading…
Cancel
Save