@cryptotaxi247 / kubo / commits / 753066b8c

daemon: move gateway start to latter

To prevent panic when daemon closes early. License: MIT Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>

Jakub Sztandera committed Feb 24, 2017 at 15:25 UTC 753066b8cd4fcad46b3d9486eab304e5721ae9ff
1 file changed +11 -11
cmd/ipfs/daemon.go
+11 -11
@@ -372,17 +372,6 @@ func daemonFunc(req cmds.Request, res cmds.Response) {
372 return
373 }
374
375 - // construct http gateway - if it is set in the config
376 - var gwErrc <-chan error
377 - if len(cfg.Addresses.Gateway) > 0 {
378 - var err error
379 - err, gwErrc = serveHTTPGateway(req)
380 - if err != nil {
381 - res.SetError(err, cmds.ErrNormal)
382 - return
383 - }
384 - }
385 -
375 // construct fuse mountpoints - if the user provided the --mount flag
376 mount, _, err := req.Option(mountKwd).Bool()
377 if err != nil {
@@ -408,6 +397,17 @@ func daemonFunc(req cmds.Request, res cmds.Response) {
397 return
398 }
399
400 + // construct http gateway - if it is set in the config
401 + var gwErrc <-chan error
402 + if len(cfg.Addresses.Gateway) > 0 {
403 + var err error
404 + err, gwErrc = serveHTTPGateway(req)
405 + if err != nil {
406 + res.SetError(err, cmds.ErrNormal)
407 + return
408 + }
409 + }
410 +
411 // initialize metrics collector
412 prometheus.MustRegister(&corehttp.IpfsNodeCollector{Node: node})
413