Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement ConnectionTimeout #90

Open
4 tasks
JohannesKaufmann opened this issue Jan 5, 2018 · 0 comments
Open
4 tasks

Implement ConnectionTimeout #90

JohannesKaufmann opened this issue Jan 5, 2018 · 0 comments

Comments

@JohannesKaufmann
Copy link
Contributor

The Client already has the field ConnectionTimeout but it is not implemented yet. As the internal server list is quite outdated it would be usefull for beginners to understand quite quickly why there code is not working. The library should Timeout after a few seconds and emit an event.

  • Implement Timeout
  • Add default ConnectionTimeout value
  • Add TimeoutError Event
  • Update GoDocs Example to include the TimeoutError Event (also LogOnFailedEvent and a comment about SteamGuard)

In the function dialTCP (connection.go#L32) replace

conn, err := net.DialTCP("tcp", laddr, raddr)

with

d := net.Dialer{Timeout: time.Second * 1}
conn, err := d.Dial("tcp", raddr.String())

Also in the struct tcpConnection (#L26) the type for conn needs to be changed from

type tcpConnection struct {
	conn        *net.TCPConn
	ciph        cipher.Block
	cipherMutex sync.RWMutex
}

to

type tcpConnection struct {
	conn        net.Conn
	ciph        cipher.Block
	cipherMutex sync.RWMutex
}

I don't have enough knowledge in the internals of this library to safely implement it but I hope that this is enough information for you to implement and properly test it.

P.S.: It would be really helpfull if you would upload maybe a drawing that shows how a protobuf message travels through your library until it is send of. Or maybe just a short description in a markdown document on how this library works under the hood.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant