Ver código fonte

Fix: should close TCP/UDP endpoint on exit

kr328 4 anos atrás
pai
commit
42f5331a0c
1 arquivos alterados com 4 adições e 0 exclusões
  1. 4 0
      core/src/main/golang/tun/tun.go

+ 4 - 0
core/src/main/golang/tun/tun.go

@@ -72,6 +72,8 @@ func Start(fd, mtu int, dns string) error {
 	go func() {
 		// lwip tcp
 
+		defer stack.TCP().Close()
+
 		for {
 			conn, err := stack.TCP().Accept()
 			if err != nil {
@@ -94,6 +96,8 @@ func Start(fd, mtu int, dns string) error {
 	go func() {
 		// lwip udp
 
+		defer stack.UDP().Close()
+
 		for {
 			buf := allocUDP(mtu)