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

Setting UpdateTypeClientInfo to UpdateFrequencyAutomatically throws Panic when server info is queried. #2

Open
Baa14453 opened this issue Dec 1, 2021 · 0 comments

Comments

@Baa14453
Copy link

Baa14453 commented Dec 1, 2021

This is very odd, but if you request that UpdateTypeClientInfo is set to UpdateFrequencyAutomatically ie:
sess.RequestUpdates(enum.UpdateTypeClientInfo, enum.UpdateFrequencyAutomatically)

and then query server info, by either viewing the server in OpenTTD Multiplayer List or clicking the Refresh server

gopenttd will Panic with:

"reflect.Set: value of type uint8 is not assignable to type enum.NetE...
Stack:
	2  0x00000000004a4ad1 in reflect.Value.assignTo
	    at /snap/go/current/src/reflect/value.go:2797
	3  0x00000000004a1a32 in reflect.Value.Set
	    at /snap/go/current/src/reflect/value.go:1905
	4  0x000000000075d51e in github.com/ropenttd/gopenttd/pkg/admin.ottdUnmarshalData
	    at /home/baa/go/pkg/mod/memleak.eu/sn0w/gopenttd@v0.0.0-20211127193137-1cf6e0e4dba6/pkg/admin/proto_unmarshal.go:46
	5  0x000000000075d0b8 in github.com/ropenttd/gopenttd/pkg/admin.ottdUnmarshal
	    at /home/baa/go/pkg/mod/memleak.eu/sn0w/gopenttd@v0.0.0-20211127193137-1cf6e0e4dba6/pkg/admin/proto_unmarshal.go:26
	6  0x000000000075c2c5 in github.com/ropenttd/gopenttd/pkg/admin.(*Session).onEvent
	    at /home/baa/go/pkg/mod/memleak.eu/sn0w/gopenttd@v0.0.0-20211127193137-1cf6e0e4dba6/pkg/admin/proto_api.go:419
	7  0x000000000075b42b in github.com/ropenttd/gopenttd/pkg/admin.(*Session).listen
	    at /home/baa/go/pkg/mod/memleak.eu/sn0w/gopenttd@v0.0.0-20211127193137-1cf6e0e4dba6/pkg/admin/proto_api.go:287
	8  0x000000000075a1c7 in github.com/ropenttd/gopenttd/pkg/admin.(*Session).Open·dwrap·10
	    at /home/baa/go/pkg/mod/memleak.eu/sn0w/gopenttd@v0.0.0-20211127193137-1cf6e0e4dba6/pkg/admin/proto_api.go:108

I find that setting type NetError uint8 to type NetError int8 under pgk/enum/constants.go resolves the issue... but I'm not sure if that's correct or not: https://memleak.eu/sn0w/gopenttd/commit/63e5c696f0cd942a7b7388881e08f95225ce88ac

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