Browse code

Removed unused state functions

This removes the SetStoppedLocking, and
SetRestartingLocking functions, which
were not used anywhere.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>

Sebastiaan van Stijn authored on 2016/09/20 20:09:18
Showing 2 changed files
... ...
@@ -156,7 +156,7 @@ func wait(waitChan <-chan struct{}, timeout time.Duration) error {
156 156
 
157 157
 // WaitStop waits until state is stopped. If state already stopped it returns
158 158
 // immediately. If you want wait forever you must supply negative timeout.
159
-// Returns exit code, that was passed to SetStoppedLocking
159
+// Returns exit code, that was passed to SetStopped
160 160
 func (s *State) WaitStop(timeout time.Duration) (int, error) {
161 161
 	s.Lock()
162 162
 	if !s.Running {
... ...
@@ -243,13 +243,6 @@ func (s *State) SetRunning(pid int, initial bool) {
243 243
 	}
244 244
 }
245 245
 
246
-// SetStoppedLocking locks the container state and sets it to "stopped".
247
-func (s *State) SetStoppedLocking(exitStatus *ExitStatus) {
248
-	s.Lock()
249
-	s.SetStopped(exitStatus)
250
-	s.Unlock()
251
-}
252
-
253 246
 // SetStopped sets the container state to "stopped" without locking.
254 247
 func (s *State) SetStopped(exitStatus *ExitStatus) {
255 248
 	s.Running = false
... ...
@@ -262,15 +255,7 @@ func (s *State) SetStopped(exitStatus *ExitStatus) {
262 262
 	s.waitChan = make(chan struct{})
263 263
 }
264 264
 
265
-// SetRestartingLocking is when docker handles the auto restart of containers when they are
266
-// in the middle of a stop and being restarted again
267
-func (s *State) SetRestartingLocking(exitStatus *ExitStatus) {
268
-	s.Lock()
269
-	s.SetRestarting(exitStatus)
270
-	s.Unlock()
271
-}
272
-
273
-// SetRestarting sets the container state to "restarting".
265
+// SetRestarting sets the container state to "restarting" without locking.
274 266
 // It also sets the container PID to 0.
275 267
 func (s *State) SetRestarting(exitStatus *ExitStatus) {
276 268
 	// we should consider the container running when it is restarting because of
... ...
@@ -30,7 +30,9 @@ func TestStateRunStop(t *testing.T) {
30 30
 			atomic.StoreInt64(&exit, int64(exitCode))
31 31
 			close(stopped)
32 32
 		}()
33
-		s.SetStoppedLocking(&ExitStatus{ExitCode: i})
33
+		s.Lock()
34
+		s.SetStopped(&ExitStatus{ExitCode: i})
35
+		s.Unlock()
34 36
 		if s.IsRunning() {
35 37
 			t.Fatal("State is running")
36 38
 		}
... ...
@@ -70,7 +72,9 @@ func TestStateTimeoutWait(t *testing.T) {
70 70
 		t.Log("Stop callback fired")
71 71
 	}
72 72
 
73
-	s.SetStoppedLocking(&ExitStatus{ExitCode: 1})
73
+	s.Lock()
74
+	s.SetStopped(&ExitStatus{ExitCode: 1})
75
+	s.Unlock()
74 76
 
75 77
 	stopped = make(chan struct{})
76 78
 	go func() {