fix issue

This commit is contained in:
Ho
2026-01-21 22:14:31 +09:00
parent 2c14342df3
commit 3a871717db
2 changed files with 4 additions and 3 deletions

View File

@@ -123,8 +123,8 @@ func (c *upClient) Login(ctx context.Context, genLogin func(string) (*types.Logi
}
func handleHttpResp(resp *http.Response) (*ctypes.Response, error) {
defer resp.Body.Close()
if resp.StatusCode == http.StatusOK || resp.StatusCode == http.StatusUnauthorized {
defer resp.Body.Close()
var respWithData ctypes.Response
// Note: Body is consumed after decoding, caller should not read it again
if err := json.NewDecoder(resp.Body).Decode(&respWithData); err == nil {

View File

@@ -114,12 +114,13 @@ func (c *proverSession) maintainLogin(ctx context.Context, cliMgr Client, up str
waitctx := c.completionCtx
c.Unlock()
select {
case <-waitctx.Done():
return c.maintainLogin(ctx, cliMgr, up, param, phase)
case <-ctx.Done():
nerr = fmt.Errorf("ctx fail")
return
default:
}
<-waitctx.Done()
return c.maintainLogin(ctx, cliMgr, up, param, phase)
}
if phase < curPhase {