Compare commits

..

1 Commits

Author SHA1 Message Date
Christian Schwarz 2efbf19c62 REWORD ToString in log message 2020-02-25 15:44:23 +01:00
4 changed files with 5 additions and 27 deletions
+2 -2
View File
@@ -147,8 +147,8 @@ func (j *controlJob) Run(ctx context.Context) {
server := http.Server{
Handler: mux,
// control socket is local, 1s timeout should be more than sufficient, even on a loaded system
WriteTimeout: envconst.Duration("ZREPL_DAEMON_CONTROL_WRITE_TIMEOUT", 1*time.Second),
ReadTimeout: envconst.Duration("ZREPL_DAEMON_CONTROL_READ_TIMEOUT", 1*time.Second),
WriteTimeout: 1 * time.Second,
ReadTimeout: 1 * time.Second,
}
outer:
+1 -12
View File
@@ -198,11 +198,7 @@ func (s *Sender) Send(ctx context.Context, r *pdu.SendReq) (*pdu.SendRes, zfs.St
if err != nil {
return nil, nil, err
}
defer func(guardp **semaphore.AcquireGuard) {
if *guardp != nil {
(*guardp).Release()
}
}(&guard)
defer guard.Release()
si, err := zfs.ZFSSendDry(ctx, sendArgs)
if err != nil {
@@ -259,13 +255,6 @@ func (s *Sender) Send(ctx context.Context, r *pdu.SendReq) (*pdu.SendRes, zfs.St
if err != nil {
return nil, nil, errors.Wrap(err, "zfs send failed")
}
// defer releasing guard until streamCopier is closed
streamCopier.SetPostCloseCallback(func(_ error) {
guard.Release()
})
guard = nil
return res, streamCopier, nil
}
-1
View File
@@ -63,7 +63,6 @@ type FilesystemPlaceholderState struct {
// For nonexistent FS, err == nil and state.FSExists == false
func ZFSGetFilesystemPlaceholderState(p *DatasetPath) (state *FilesystemPlaceholderState, err error) {
state = &FilesystemPlaceholderState{FS: p.ToString()}
state.FS = p.ToString()
props, err := zfsGet(p.ToString(), []string{PlaceholderPropertyName}, sourceLocal)
var _ error = (*DatasetDoesNotExist)(nil) // weak assertion on zfsGet's interface
if _, ok := err.(*DatasetDoesNotExist); ok {
+2 -12
View File
@@ -350,8 +350,7 @@ func (a ZFSSendArgs) buildCommonSendArgs() ([]string, error) {
}
type ReadCloserCopier struct {
recorder readErrRecorder
postCloseCallback func(closeErr error)
recorder readErrRecorder
}
type readErrRecorder struct {
@@ -403,17 +402,8 @@ func (c *ReadCloserCopier) Read(p []byte) (n int, err error) {
return c.recorder.Read(p)
}
// caller must ensure that this function is not executing concurrently to Close
func (c *ReadCloserCopier) SetPostCloseCallback(callback func(closeErr error)) {
c.postCloseCallback = callback
}
func (c *ReadCloserCopier) Close() error {
err := c.recorder.Close()
if c.postCloseCallback != nil {
c.postCloseCallback(err)
}
return err
return c.recorder.ReadCloser.Close()
}
func pipeWithCapacityHint(capacity int) (r, w *os.File, err error) {