Skip to content

Commit

Permalink
Fixes #9.
Browse files Browse the repository at this point in the history
  • Loading branch information
luskaner committed Jul 20, 2024
1 parent 034b4c0 commit 1fc7a58
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions launcher-watcher/internal/watch.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func waitForProcess(name string) bool {
return true
}

func Watch(watchedProcess string, serverPid uint32, revertArgs []string, exitCode *int) {
func Watch(watchedProcess string, serverPid int, revertArgs []string, exitCode *int) {
*exitCode = common.ErrSuccess
if len(revertArgs) > 0 {
defer func() {
Expand All @@ -47,7 +47,7 @@ func Watch(watchedProcess string, serverPid uint32, revertArgs []string, exitCod
}
if waitForProcess(watchedProcess) {
if serverPid > 0 {
if err := executor.Kill(int(serverPid)); err != nil {
if err := executor.Kill(serverPid); err != nil {
log.Println("Failed to stop server.")
*exitCode = ErrFailedStopServer
}
Expand Down
4 changes: 2 additions & 2 deletions launcher-watcher/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ func main() {
}
}()
watchedProcess := os.Args[1]
serverPid, err := strconv.ParseUint(os.Args[2], 10, 32)
serverPid, err := strconv.ParseInt(os.Args[2], 10, 32)
if err != nil {
log.Println("Failed to parse server pid.")
exitCode = internal.ErrParseServerPid
return
}
internal.Watch(watchedProcess, uint32(serverPid), revertFlags, &exitCode)
internal.Watch(watchedProcess, int(serverPid), revertFlags, &exitCode)
os.Exit(exitCode)
}
2 changes: 1 addition & 1 deletion server/routes/game/advertisement/leave.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
func Leave(w http.ResponseWriter, r *http.Request) {
sess, _ := middleware.Session(r)
advStr := r.PostFormValue("advertisementid")
advId, err := strconv.ParseUint(advStr, 10, 32)
advId, err := strconv.ParseInt(advStr, 10, 32)
if err != nil {
i.JSON(&w, i.A{2})
return
Expand Down
3 changes: 2 additions & 1 deletion server/routes/game/relationship/ignore.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ import (
func Ignore(w http.ResponseWriter, r *http.Request) {
// TODO: Implement just in memory?
profileIdStr := r.PostFormValue("targetProfileID")
profileId, err := strconv.Atoi(profileIdStr)

profileId, err := strconv.ParseInt(profileIdStr, 10, 32)
if err != nil {
i.JSON(&w, i.A{2, i.A{}, i.A{}})
return
Expand Down
2 changes: 1 addition & 1 deletion server/routes/game/relationship/setPresence.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ func SetPresence(w http.ResponseWriter, r *http.Request) {
i.JSON(&w, i.A{2})
return
}
presence, err := strconv.Atoi(presenceId)
presence, err := strconv.ParseInt(presenceId, 10, 8)
if err != nil {
i.JSON(&w, i.A{2})
return
Expand Down

0 comments on commit 1fc7a58

Please sign in to comment.