piper: pipe cleanup on early return, write error; misc error hygiene
piper_handler: close stdin/stdout pipes on Start() failure and on WriteString error instead of leaking fds. Propagate WriteString error. worker/client: log SetDeadline errors instead of discarding them. voice/session: pushAudio marshals params inline and returns the marshal error instead of swallowing it via mustParams (removed). tool/matcher: log ListTools errors instead of silently returning an empty allowlist that refuses every act. config: applyDefaults now sets RouterThreshold and ToolTimeout defaults so consumers self-contained defaults are belt-and-suspenders.
This commit is contained in:
@@ -20,6 +20,7 @@ import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"log"
|
||||
"net"
|
||||
"sync"
|
||||
"time"
|
||||
@@ -95,9 +96,13 @@ func (c *Client) call(ctx context.Context, m Method, params any, out any) error
|
||||
// half-sent frame would desync the stream. Teardown is the clean
|
||||
// recovery; the next call re-dials.
|
||||
if dl, ok := ctx.Deadline(); ok {
|
||||
_ = c.c.SetDeadline(dl)
|
||||
if err := c.c.SetDeadline(dl); err != nil {
|
||||
log.Printf("worker: set deadline: %v", err)
|
||||
}
|
||||
} else {
|
||||
_ = c.c.SetDeadline(time.Now().Add(defaultCallTimeout))
|
||||
if err := c.c.SetDeadline(time.Now().Add(defaultCallTimeout)); err != nil {
|
||||
log.Printf("worker: set deadline: %v", err)
|
||||
}
|
||||
}
|
||||
defer c.c.SetDeadline(time.Time{})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user