Open Source Routing Machine - C++ backend
c-plus-pluscppcpp17isochronesmap-matchingopenstreetmaposmosrmroutingrouting-enginetraveling-salesman
This extends the compressed output vector's lifetime, as we issue an asynchronous write operation that only receives a non-owning buffer to the compressed data. When the compressed output vector then goes out of scope, its destructor is called and the data gets (potentially) destroyed. If the asynchronous write happens afterwards, it's accessing data that is no longer there. This is the reason for race conditions --- well, for undefined behavior in general, but it manifests in the routed _sometimes_ not responding at all. The fix works like this: keep the compressed output associated with a connection. Connections inherit from `std::enable_shared_from_this` and issues a `shared_from_this()` call, passing a `std::shared_ptr` to the asynchronous write function, thus extending their lifetime. Connecitons thus manage their lifetime by themselves, extending it when needed (and of course via the `std::shared_pointers` pointing to it). Buffer's non owning property, from the `async_write` documentation: > One or more buffers containing the data to be written. Although > the buffers object may be copied as necessary, ownership of the > underlying memory blocks is retained by the caller, which must > guarantee that they remain valid until the handler is called. Reference: - http://www.boost.org/doc/libs/1_59_0/doc/html/boost_asio/reference/async_write/overload1.html |
||
---|---|---|
algorithms | ||
benchmarks | ||
cmake | ||
config | ||
contractor | ||
data_structures | ||
descriptors | ||
docker | ||
extractor | ||
features | ||
include/osrm | ||
library | ||
plugins | ||
profiles | ||
routing_algorithms | ||
server | ||
test | ||
third_party | ||
tools | ||
unit_tests | ||
util | ||
.clang-format | ||
.gitignore | ||
.gitmodules | ||
.travis.yml | ||
appveyor-build.bat | ||
appveyor.yml | ||
build-local.bat | ||
CMakeLists.txt | ||
datastore.cpp | ||
extract.cpp | ||
Gemfile | ||
Gemfile.lock | ||
LICENCE.TXT | ||
prepare.cpp | ||
profile.lua | ||
Rakefile | ||
README.md | ||
routed.cpp | ||
taginfo.json | ||
typedefs.h | ||
update_depdendencies.sh |
About
The Open Source Routing Machine is a high performance routing engine written in C++11 designed to run on OpenStreetMap data.
Current build status
build config | branch | status |
---|---|---|
Linux | master | ![]() |
Linux | develop | ![]() |
Windows | master/develop | |
LUAbind fork | master | ![]() |
Building
For instructions on how to build and run OSRM, please consult the Wiki.
To quickly try OSRM use our free and daily updated online service
Documentation
See the Wiki's server API documentation as well as the library API documentation
References in publications
When using the code in a (scientific) publication, please cite
@inproceedings{luxen-vetter-2011,
author = {Luxen, Dennis and Vetter, Christian},
title = {Real-time routing with OpenStreetMap data},
booktitle = {Proceedings of the 19th ACM SIGSPATIAL International Conference on Advances in Geographic Information Systems},
series = {GIS '11},
year = {2011},
isbn = {978-1-4503-1031-4},
location = {Chicago, Illinois},
pages = {513--516},
numpages = {4},
url = {http://doi.acm.org/10.1145/2093973.2094062},
doi = {10.1145/2093973.2094062},
acmid = {2094062},
publisher = {ACM},
address = {New York, NY, USA},
}