Browse Source

Fixed Upnp bug

obscuren 11 năm trước cách đây
mục cha
commit
91aa189ef3
2 tập tin đã thay đổi với 5 bổ sung1 xóa
  1. 1 1
      ethereum.go
  2. 4 0
      natupnp.go

+ 1 - 1
ethereum.go

@@ -350,7 +350,7 @@ func (s *Ethereum) WaitForShutdown() {
 func (s *Ethereum) upnpUpdateThread() {
 	// Go off immediately to prevent code duplication, thereafter we renew
 	// lease every 15 minutes.
-	timer := time.NewTimer(0 * time.Second)
+	timer := time.NewTimer(5 * time.Minute)
 	lport, _ := strconv.ParseInt(s.Port, 10, 16)
 	first := true
 out:

+ 4 - 0
natupnp.go

@@ -246,6 +246,10 @@ func soapRequest(url, function, message string) (r *http.Response, err error) {
 	//fmt.Println(fullMessage)
 
 	r, err = http.DefaultClient.Do(req)
+	if err != nil {
+		return
+	}
+
 	if r.Body != nil {
 		defer r.Body.Close()
 	}