Skip to content

Commit

Permalink
Fix a stupid mistake which causes the client to always establish 3 TC…
Browse files Browse the repository at this point in the history
…P connections to the server when only one is intended
  • Loading branch information
cbeuw committed Mar 17, 2018
1 parent 028d965 commit 2151972
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion cmd/gq-client/gq-client.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,11 @@ func initSequence(ssConn net.Conn, sta *gqclient.State) {
data = data[:i]

var remoteConn net.Conn
for trial := 0; err == nil && trial < 3; trial++ {
for trial := 0; trial < 3; trial++ {
remoteConn, err = net.Dial("tcp", sta.SS_REMOTE_HOST+":"+sta.SS_REMOTE_PORT)
if err == nil {
break
}
}
if remoteConn == nil {
log.Println("Failed to connect to the proxy server")
Expand Down

0 comments on commit 2151972

Please sign in to comment.