MCPcopy
hub / github.com/syncthing/syncthing / Stop

Method Stop

lib/rc/rc.go:140–156  ·  view source on GitHub ↗

Stop stops the running Syncthing process. If the process was logging to a local file (set by LogTo), the log file will be opened and checked for panics and data races. The presence of either will be signalled in the form of a returned error.

()

Source from the content-addressed store, hash-verified

138// panics and data races. The presence of either will be signalled in the form
139// of a returned error.
140func (p *Process) Stop() (*os.ProcessState, error) {
141 select {
142 case <-p.stopped:
143 return p.cmd.ProcessState, p.stopErr
144 default:
145 }
146
147 if _, err := p.Post("/rest/system/shutdown", nil); err != nil && !errors.Is(err, io.ErrUnexpectedEOF) {
148 // Unexpected EOF is somewhat expected here, as we may exit before
149 // returning something sensible.
150 return nil, err
151 }
152
153 <-p.stopped
154
155 return p.cmd.ProcessState, p.stopErr
156}
157
158// Stopped returns a channel that will be closed when Syncthing has stopped.
159func (p *Process) Stopped() chan struct{} {

Callers 15

ServeMethod · 0.45
pingSenderMethod · 0.45
pingReceiverMethod · 0.45
connectMethod · 0.45
ServeMethod · 0.45
NewLoggerFunction · 0.45
sendEventMethod · 0.45
SubscribeMethod · 0.45
PollMethod · 0.45
SinceMethod · 0.45
mainLoopMethod · 0.45
WatchMethod · 0.45

Calls 2

PostMethod · 0.95
IsMethod · 0.45

Tested by 4

benchmarkTransferFunction · 0.36
TestResetFunction · 0.36
benchmarkURLFunction · 0.36