mirror of
https://github.com/jwetzell/showbridge-go.git
synced 2026-04-26 21:05:30 +00:00
reorder payload type check in udp client
This commit is contained in:
@@ -76,6 +76,11 @@ func (uc *UDPClient) Run() error {
|
||||
|
||||
func (uc *UDPClient) Output(payload any) error {
|
||||
|
||||
payloadBytes, ok := payload.([]byte)
|
||||
if !ok {
|
||||
return fmt.Errorf("net.udp.client is only able to output bytes")
|
||||
}
|
||||
|
||||
client, err := net.DialUDP("udp", nil, uc.addr)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -83,11 +88,6 @@ func (uc *UDPClient) Output(payload any) error {
|
||||
|
||||
uc.conn = client
|
||||
|
||||
payloadBytes, ok := payload.([]byte)
|
||||
if !ok {
|
||||
return fmt.Errorf("net.udp.client is only able to output bytes")
|
||||
}
|
||||
|
||||
_, err = uc.conn.Write(payloadBytes)
|
||||
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user