forked from External/ergo
fix #791
This commit is contained in:
parent
0d5a4fd584
commit
41813cc15a
1 changed files with 19 additions and 0 deletions
|
|
@ -804,6 +804,25 @@ func debugHandler(server *Server, client *Client, msg ircmsg.IrcMessage, rb *Res
|
||||||
case "STOPCPUPROFILE":
|
case "STOPCPUPROFILE":
|
||||||
pprof.StopCPUProfile()
|
pprof.StopCPUProfile()
|
||||||
rb.Notice(fmt.Sprintf("CPU profiling stopped"))
|
rb.Notice(fmt.Sprintf("CPU profiling stopped"))
|
||||||
|
|
||||||
|
case "CRASHSERVER":
|
||||||
|
if !client.HasRoleCapabs("oper:rehash") {
|
||||||
|
rb.Notice(client.t("You must have rehash permissions in order to execute DEBUG CRASHSERVER"))
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
code := unregisterConfirmationCode(server.name, server.ctime)
|
||||||
|
if len(msg.Params) == 1 || msg.Params[1] != code {
|
||||||
|
rb.Notice(fmt.Sprintf(client.t("To crash the server, issue the following command: /DEBUG CRASHSERVER %s"), code))
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
go func() {
|
||||||
|
// intentional nil dereference on a new goroutine, bypassing recover-from-errors
|
||||||
|
var i, j *int
|
||||||
|
*i = *j
|
||||||
|
}()
|
||||||
|
|
||||||
|
default:
|
||||||
|
rb.Notice(client.t("Unrecognized DEBUG subcommand"))
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue