Skip to content

Commit 2324c08

Browse files
author
Mathieu Lecarme
committed
More simple.
1 parent 14ac3b6 commit 2324c08

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

message/ping.go

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,25 +64,23 @@ func (s *FluentSession) doPingPong() error {
6464
pingKey := hex.EncodeToString(shared_key_hexdigest.Sum(nil))
6565

6666
hr := sha512.New()
67-
ping["server_hostname"] = s.Hostname
68-
69-
for _, k := range []string{"shared_key_salt", "server_hostname", "nonce"} {
70-
hr.Write([]byte(ping[k]))
71-
}
67+
hr.Write([]byte(ping["shared_key_salt"]))
68+
hr.Write([]byte(s.Hostname))
69+
hr.Write([]byte(s.nonce))
7270
hr.Write([]byte(s.SharedKey))
7371

7472
fmt.Println("PONG")
7573
if ping["shared_key_hexdigest"] != pingKey {
7674
_list(s.encoder, "PONG",
7775
false, "shared key mismatch",
78-
ping["server_hostname"],
76+
s.Hostname,
7977
hex.EncodeToString(hr.Sum(nil)),
8078
)
8179
return fmt.Errorf("shared key mismatch %v != %v", ping["shared_key_hexdigest"], pingKey)
8280
}
8381
_list(s.encoder, "PONG",
8482
true, "",
85-
ping["server_hostname"],
83+
s.Hostname,
8684
hex.EncodeToString(hr.Sum(nil)),
8785
)
8886

0 commit comments

Comments
 (0)