aboutsummaryrefslogtreecommitdiffstats
path: root/swarm/network/simulation/http.go
diff options
context:
space:
mode:
Diffstat (limited to 'swarm/network/simulation/http.go')
-rw-r--r--swarm/network/simulation/http.go11
1 files changed, 8 insertions, 3 deletions
diff --git a/swarm/network/simulation/http.go b/swarm/network/simulation/http.go
index 40f13f32d..69ae3baec 100644
--- a/swarm/network/simulation/http.go
+++ b/swarm/network/simulation/http.go
@@ -29,7 +29,7 @@ var (
DefaultHTTPSimAddr = ":8888"
)
-//`With`(builder) pattern constructor for Simulation to
+//WithServer implements the builder pattern constructor for Simulation to
//start with a HTTP server
func (s *Simulation) WithServer(addr string) *Simulation {
//assign default addr if nothing provided
@@ -46,7 +46,12 @@ func (s *Simulation) WithServer(addr string) *Simulation {
Addr: addr,
Handler: s.handler,
}
- go s.httpSrv.ListenAndServe()
+ go func() {
+ err := s.httpSrv.ListenAndServe()
+ if err != nil {
+ log.Error("Error starting the HTTP server", "error", err)
+ }
+ }()
return s
}
@@ -55,7 +60,7 @@ func (s *Simulation) addSimulationRoutes() {
s.handler.POST("/runsim", s.RunSimulation)
}
-// StartNetwork starts all nodes in the network
+// RunSimulation is the actual POST endpoint runner
func (s *Simulation) RunSimulation(w http.ResponseWriter, req *http.Request) {
log.Debug("RunSimulation endpoint running")
s.runC <- struct{}{}