Jelajahi Sumber

Move job register into servapi
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)

Michael Crosby 11 tahun lalu
induk
melakukan
e743021193
1 mengubah file dengan 4 tambahan dan 1 penghapusan
  1. 4 1
      api/api.go

+ 4 - 1
api/api.go

@@ -52,7 +52,6 @@ type HttpApiFunc func(eng *engine.Engine, version float64, w http.ResponseWriter
 
 
 func init() {
 func init() {
 	engine.Register("serveapi", ServeApi)
 	engine.Register("serveapi", ServeApi)
-	engine.Register("acceptconnections", AcceptConnections)
 }
 }
 
 
 func hijackServer(w http.ResponseWriter) (io.ReadCloser, io.Writer, error) {
 func hijackServer(w http.ResponseWriter) (io.ReadCloser, io.Writer, error) {
@@ -1211,6 +1210,10 @@ func ServeApi(job *engine.Job) engine.Status {
 	)
 	)
 	activationLock = make(chan struct{})
 	activationLock = make(chan struct{})
 
 
+	if err := job.Eng.Register("acceptconnections", AcceptConnections); err != nil {
+		return job.Error(err)
+	}
+
 	for _, protoAddr := range protoAddrs {
 	for _, protoAddr := range protoAddrs {
 		protoAddrParts := strings.SplitN(protoAddr, "://", 2)
 		protoAddrParts := strings.SplitN(protoAddr, "://", 2)
 		go func() {
 		go func() {