File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -80,6 +80,8 @@ func StartAdvertiser() {
8080 }
8181 go func () {
8282 sessionId := - 1
83+ oldVersion := ""
84+ oldAddress := ""
8385 // Track accumulated transient errors and kill the advertiser if we exceed a threshold
8486 transientErrors := 0
8587 for {
@@ -126,6 +128,14 @@ func StartAdvertiser() {
126128 MaxPlayers : maxplayers ,
127129 Type : platform ,
128130 }
131+ // Check if the version or address has changed since last advertisement
132+ if (oldVersion != adMessage .Version ) || (oldAddress != adMessage .Address ) {
133+ // Reset sessionId to force a new advertisement
134+ adMessage .SessionId = - 1
135+ }
136+ // Update the saved values
137+ oldVersion = adMessage .Version
138+ oldAddress = adMessage .Address
129139 body , err := json .Marshal (adMessage )
130140 if err != nil {
131141 logger .Advertiser .Warnf ("ServerAdvertiser failed to Serialize to JSON from native Go struct type: %v" , err )
You can’t perform that action at this time.
0 commit comments