From 86cc0e31f1e247d231ff465a4bc2a00492b2a901 Mon Sep 17 00:00:00 2001 From: sago35 Date: Sun, 25 Dec 2022 11:30:49 +0900 Subject: [PATCH] rtl8720dn: add handling when connect fails --- rtl8720dn/netdriver.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/rtl8720dn/netdriver.go b/rtl8720dn/netdriver.go index 73e6cc4..629b491 100644 --- a/rtl8720dn/netdriver.go +++ b/rtl8720dn/netdriver.go @@ -71,10 +71,13 @@ func (d *Driver) ConnectTCPSocket(addr, port string) error { name[6] = byte(ipaddr[2]) name[7] = byte(ipaddr[3]) - _, err = d.Rpc_lwip_connect(socket, name, uint32(len(name))) + result, err := d.Rpc_lwip_connect(socket, name, uint32(len(name))) if err != nil { return err } + if result == -1 { + return fmt.Errorf("failed to connect to %d.%d.%d.%d port %s", addr[0], addr[1], addr[2], addr[3], port) + } readset := []byte{} writeset := []byte{0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}