@@ -77,8 +77,6 @@ namespace {
77
77
78
78
// Form output information based on path edges
79
79
auto trip_path = thor::TripPathBuilder::Build (reader, path_edges, origin, destination);
80
- path_algorithm.Clear ();
81
- locations.clear ();
82
80
83
81
// pass it on
84
82
worker_t ::result_t result{true };
@@ -142,6 +140,10 @@ namespace {
142
140
}
143
141
cost = factory.Create (costing, config_costing);
144
142
}
143
+ void cleanup () {
144
+ path_algorithm.Clear ();
145
+ locations.clear ();
146
+ }
145
147
protected:
146
148
boost::property_tree::ptree config;
147
149
std::vector<Location> locations;
@@ -165,8 +167,10 @@ namespace valhalla {
165
167
166
168
// listen for requests
167
169
zmq::context_t context;
170
+ thor_worker_t thor_worker (config);
168
171
prime_server::worker_t worker (context, upstream_endpoint, downstream_endpoint, loopback_endpoint,
169
- std::bind (&thor_worker_t ::work, thor_worker_t (config), std::placeholders::_1, std::placeholders::_2));
172
+ std::bind (&thor_worker_t ::work, std::ref (thor_worker), std::placeholders::_1, std::placeholders::_2),
173
+ std::bind (&thor_worker_t ::cleanup, std::ref (thor_worker)));
170
174
worker.work ();
171
175
172
176
// TODO: should we listen for SIGINT and terminate gracefully/exit(0)?
0 commit comments