go-steam
go-steam copied to clipboard
Implement ConnectionTimeout
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.