mirror of
https://github.com/jwetzell/showbridge-go.git
synced 2026-04-26 21:05:30 +00:00
add SetupConn method to net.udp.client
This commit is contained in:
@@ -65,14 +65,19 @@ func (uc *UDPClient) Type() string {
|
|||||||
return uc.config.Type
|
return uc.config.Type
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (uc *UDPClient) SetupConn() error {
|
||||||
|
client, err := net.DialUDP("udp", nil, uc.Addr)
|
||||||
|
uc.conn = client
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
func (uc *UDPClient) Run() error {
|
func (uc *UDPClient) Run() error {
|
||||||
|
|
||||||
client, err := net.DialUDP("udp", nil, uc.Addr)
|
err := uc.SetupConn()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
uc.conn = client
|
|
||||||
<-uc.ctx.Done()
|
<-uc.ctx.Done()
|
||||||
slog.Debug("router context done in module", "id", uc.config.Id)
|
slog.Debug("router context done in module", "id", uc.config.Id)
|
||||||
if uc.conn != nil {
|
if uc.conn != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user