mirror of
https://github.com/FrankerFaceZ/FrankerFaceZ.git
synced 2025-08-06 06:10:54 +00:00
Align memstats, error on non-200 responses
This commit is contained in:
parent
b2624ec77f
commit
18619eddd3
2 changed files with 17 additions and 2 deletions
|
@ -61,7 +61,7 @@ func commandLineConsole() {
|
||||||
if val.Mallocs == 0 {
|
if val.Mallocs == 0 {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
shell.Println(val.Size, "bytes:", val.Mallocs, "allocs", val.Frees, "frees")
|
shell.Print(fmt.Sprintf("%5d: %6d outstanding (%d total)\n", val.Size, val.Mallocs - val.Frees, val.Mallocs))
|
||||||
}
|
}
|
||||||
shell.Println(m.NumGC, "collections occurred")
|
shell.Println(m.NumGC, "collections occurred")
|
||||||
return "", nil
|
return "", nil
|
||||||
|
|
|
@ -136,9 +136,12 @@ func RequestRemoteData(remoteCommand, data string, auth AuthInfo) (responseStr s
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
defer resp.Body.Close()
|
||||||
|
if resp.StatusCode != 200 {
|
||||||
|
return "", httpError(resp.StatusCode)
|
||||||
|
}
|
||||||
|
|
||||||
respBytes, err := ioutil.ReadAll(resp.Body)
|
respBytes, err := ioutil.ReadAll(resp.Body)
|
||||||
resp.Body.Close()
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
@ -162,6 +165,10 @@ func SendAggregatedData(sealedForm url.Values) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
if resp.StatusCode != 200 {
|
||||||
|
resp.Body.Close()
|
||||||
|
return httpError(resp.StatusCode)
|
||||||
|
}
|
||||||
|
|
||||||
return resp.Body.Close()
|
return resp.Body.Close()
|
||||||
}
|
}
|
||||||
|
@ -180,6 +187,10 @@ func FetchBacklogData(chatSubs []string) ([]ClientMessage, error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
defer resp.Body.Close()
|
||||||
|
if resp.StatusCode != 200 {
|
||||||
|
return nil, httpError(resp.StatusCode)
|
||||||
|
}
|
||||||
dec := json.NewDecoder(resp.Body)
|
dec := json.NewDecoder(resp.Body)
|
||||||
var messages []ClientMessage
|
var messages []ClientMessage
|
||||||
err = dec.Decode(messages)
|
err = dec.Decode(messages)
|
||||||
|
@ -190,6 +201,10 @@ func FetchBacklogData(chatSubs []string) ([]ClientMessage, error) {
|
||||||
return messages, nil
|
return messages, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func httpError(statusCode int) error {
|
||||||
|
return fmt.Errorf("backend http error: %d", statusCode)
|
||||||
|
}
|
||||||
|
|
||||||
func GenerateKeys(outputFile, serverId, theirPublicStr string) {
|
func GenerateKeys(outputFile, serverId, theirPublicStr string) {
|
||||||
var err error
|
var err error
|
||||||
output := ConfigFile{
|
output := ConfigFile{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue