Commit Graph

17 Commits

Author SHA1 Message Date
Dennis Luxen
a4aa153ba4 Use nested namespace
It's a mechanical change to modernize the code base
2022-12-11 10:17:17 +01:00
Siarhei Fedartsou
9d160a9b5d
Revert back to using custom HTTP parser instead of Boost.Beast (#6407) 2022-10-14 14:37:33 +02:00
Siarhei Fedartsou
d143de597d
Fix bug with large HTTP requests leading to Bad Request in osrm-routed. (#6403) 2022-10-13 16:53:49 +02:00
Siarhei Fedartsou
e7185b4bcb
Use Boost.Beast to parse HTTP request (#6294) 2022-08-02 21:12:05 +01:00
Michael Bell
56a427f839 Upgrade Boost to 1.70, fix inefficient connection handling
A request to osrm-routed can be assigned to a thread which
is currently busy processing another request, even when there
are other threads/cores available. This unnecessarily delays
the response, and can make requests appear to hang when
awaiting CPU intensive requests to finish.

The issue looks like a bug in Boost.Asio multithreaded
networking stack.

osrm-routed server implementation is
heavily influenced by the HTTP server 3 example in the
Boost.Asio docs. By upgrading to Boost 1.70 and updating the
server connections to match the example provided in the 1.70
release, the problem is resolved.

The diff of the changes to the Boost.Asio stack are
vast, so it's difficult to identify the exact cause. However
the implementation change is to push the strand of execution
into the socket (and timer) objects, which suggests it could
fix the type of threading issue we are observing.
2021-09-30 22:51:12 +01:00
Daniel Patterson
50d9632ed7
Upgrade formatting to clang-format 10 (#5895)
* Update formatting tools to clang-format-10

* Reformat using clang-format-10.0.09
2020-11-26 07:21:39 -08:00
Denis Chaplygin
9efcab2108 Receive timeout should only be active for a second and
following requests on a keep-alive connections.
2019-08-23 12:21:54 +03:00
Denis Chaplygin
a7b7d77e1f Formatted the code. 2019-08-23 12:21:54 +03:00
Denis Chaplygin
22550d078f Added timeout handling for keep-alive operations. 2019-08-23 12:21:54 +03:00
Denis Chaplygin
a0582a3e68 Added keep-alive support to the http server. 2019-08-23 12:21:54 +03:00
Daniel J. Hofmann
a48f02e0da Takes care of proper special member generation globally, fixes #1689
Phew, a lot of classes were affected by this. The rationale for the
changes are as follows:

- When a type X declares any constructor, the default constructor is
  not declared, so there is no need for X() = delete there. In fact,
  there is brutal difference between those two: deleted members
  participate in overload resolution, but not-declared members do not!

- When a type X wants to be non-copyable (e.g. to be only movable, like
  threads, unique_ptrs, and so on), you can either do it by inheriting
  from boost::noncopyable (the old way), or better declare both (!) the
  copy constructor _and_ the copy assignment operator as deleted:

      X(X const&) = delete;
      X& operator=(X const&) = delete;

  We had tons of types with deleted copy constructors that were lacking
  a corresponding deleted copy assignment operator, making them still
  copyable and you wouldn't even notice (read: scary)!

References:

- http://accu.org/content/conf2014/Howard_Hinnant_Accu_2014.pdf
- http://www.boost.org/doc/libs/master/libs/core/doc/html/core/noncopyable.html

Note: I know, I'm quoting Hinnant's extraordinary slides a lot, but
getting the sematic right here is so incredibly important.
2016-01-27 17:25:30 +01:00
Daniel J. Hofmann
e7d9e42a16 Fix race condition in osrm-routed HTTP server
We had a similar issue a few month ago. Stumbled upon this by accident.

It goes like this:

- `output_buffer` is function-local
- we pass it to async_write and leave the scope
- `output_buffers` goes out of scope
- bad things happen, sometimes

The fix is to, again, put it inside the connection that handles itself
via the enable_shared_from_this idiom.

References:

- http://www.boost.org/doc/libs/1_59_0/doc/html/boost_asio/reference/async_write/overload1.html
- https://github.com/Project-OSRM/osrm-backend/pull/1690
2016-01-13 23:21:45 +01:00
Patrick Niklaus
6991a38703 Run clang-format 2016-01-08 01:31:57 +01:00
Patrick Niklaus
6b18e4f7e9 Add namespace around all files 2016-01-08 01:30:52 +01:00
Daniel J. Hofmann
685d330ee2 Remove license headers from project source files; global license 2016-01-04 19:06:32 +01:00
Patrick Niklaus
97585bb26a Fix include paths 2016-01-03 18:47:50 +01:00
Patrick Niklaus
bfc6c9b89d Move files in src/ include/ 2016-01-03 16:37:38 +01:00