Add comments

This commit is contained in:
Elara 2020-12-05 21:55:14 -08:00
parent 1c6e8244d9
commit 52b3490e08

View File

@ -121,11 +121,16 @@ func RecvFiles(senderAddr string) {
var response *http.Response var response *http.Response
// GET /index on sender's HTTP server // GET /index on sender's HTTP server
response, err := http.Get(serverAddr + "/index") response, err := http.Get(serverAddr + "/index")
// If error occurred, retry every 500ms
if err != nil { if err != nil {
// Set index failed to true
indexGetFailed := true indexGetFailed := true
for indexGetFailed { for indexGetFailed {
// GET /index on sender's HTTP server
response, err = http.Get(serverAddr + "/index") response, err = http.Get(serverAddr + "/index")
// If no error, set index failed to false
if err == nil { indexGetFailed = false } if err == nil { indexGetFailed = false }
// Wait 500s
time.Sleep(500*time.Millisecond) time.Sleep(500*time.Millisecond)
} }
} }