Skip to content
Snippets Groups Projects
Verified Commit 2a65b8bc authored by Tóth Miklós Tibor's avatar Tóth Miklós Tibor :shrug:
Browse files

Smol fix

parent 3f47038f
No related branches found
No related tags found
No related merge requests found
...@@ -25,7 +25,7 @@ func init() { ...@@ -25,7 +25,7 @@ func init() {
} }
var conn *websocket.Conn var conn *websocket.Conn
var connCh = make(chan interface{}, 5) var connCh = make(chan interface{}, 500)
var socket = "ws://127.0.0.1:8080/ws" var socket = "ws://127.0.0.1:8080/ws"
func init() { func init() {
......
...@@ -7,6 +7,7 @@ import ( ...@@ -7,6 +7,7 @@ import (
"math/rand" "math/rand"
"net/http" "net/http"
"strings" "strings"
"time"
) )
var cache = make(map[string]bool) var cache = make(map[string]bool)
...@@ -17,6 +18,15 @@ func submit(ip, pass string) ([]string, error) { ...@@ -17,6 +18,15 @@ func submit(ip, pass string) ([]string, error) {
} }
resp, e := http.Post(fmt.Sprintf("http://[%s]:8080/attempt", ip), "text/plain", strings.NewReader(pass+"\n")) resp, e := http.Post(fmt.Sprintf("http://[%s]:8080/attempt", ip), "text/plain", strings.NewReader(pass+"\n"))
if e != nil {
time.Sleep(time.Second * time.Duration(rand.Intn(5)))
resp, e = http.Post(fmt.Sprintf("http://[%s]:8080/attempt", ip), "text/plain", strings.NewReader(pass+"\n"))
if e != nil {
time.Sleep(time.Second * time.Duration(rand.Intn(5)))
resp, e = http.Post(fmt.Sprintf("http://[%s]:8080/attempt", ip), "text/plain", strings.NewReader(pass+"\n"))
}
}
if e != nil { if e != nil {
log.Println("host is ded", ip) log.Println("host is ded", ip)
return nil, e return nil, e
...@@ -56,6 +66,7 @@ func submit(ip, pass string) ([]string, error) { ...@@ -56,6 +66,7 @@ func submit(ip, pass string) ([]string, error) {
Id: rand.Int(), Id: rand.Int(),
IPs: ips, IPs: ips,
} }
defer resp.Body.Close()
return ips, e return ips, e
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment