summaryrefslogtreecommitdiff
path: root/dev-games/openscenegraph/files/openscenegraph-3.6.5-boost-1.87.0.patch
blob: 22e54593b981c14d76a04f79e88830af3d7a432f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
diff '--color=auto' -urNp openscenegraph-3.6.5-orig/src/osgPlugins/RestHttpDevice/connection.cpp openscenegraph-3.6.5-dwok/src/osgPlugins/RestHttpDevice/connection.cpp
--- openscenegraph-3.6.5-orig/src/osgPlugins/RestHttpDevice/connection.cpp	2024-12-27 12:34:55.469783593 +0100
+++ openscenegraph-3.6.5-dwok/src/osgPlugins/RestHttpDevice/connection.cpp	2024-12-27 12:45:50.072697619 +0100
@@ -10,16 +10,17 @@
 
 #include "connection.hpp"
 #include <vector>
-#include <boost/bind.hpp>
+#include <boost/bind/bind.hpp>
+using namespace boost::placeholders;
 #include "request_handler.hpp"
 #include <osg/Notify>
 
 namespace http {
 namespace server {
 
-connection::connection(asio::io_service& io_service,
+connection::connection(boost::asio::io_context& io_context,
     request_handler& handler)
-  : socket_(io_service),
+  : socket_(io_context),
     request_handler_(handler)
 {
     OSG_DEBUG << "RestHttpDevice :: connection::connection" << std::endl;
@@ -29,7 +30,7 @@ connection::~connection()
 {
     OSG_DEBUG << "RestHttpDevice :: connection::~connection" << std::endl;
 }
-asio::ip::tcp::socket& connection::socket()
+boost::asio::ip::tcp::socket& connection::socket()
 {
   return socket_;
 }
@@ -38,10 +39,8 @@ void connection::start()
 {
   OSG_DEBUG << "RestHttpDevice :: connection::start" << std::endl;
 
-  socket_.async_read_some(asio::buffer(buffer_),
-      boost::bind(&connection::handle_read, shared_from_this(),
-        asio::placeholders::error,
-        asio::placeholders::bytes_transferred));
+  socket_.async_read_some(boost::asio::buffer(buffer_),
+      boost::bind(&connection::handle_read, shared_from_this(), _1, _2));
 }
 
 void connection::handle_read(const boost::system::error_code& e,
@@ -56,23 +55,19 @@ void connection::handle_read(const boost
     if (result)
     {
       request_handler_.handle_request(request_, reply_);
-      asio::async_write(socket_, reply_.to_buffers(),
-          boost::bind(&connection::handle_write, shared_from_this(),
-            asio::placeholders::error));
+      boost::asio::async_write(socket_, reply_.to_buffers(),
+          boost::bind(&connection::handle_write, shared_from_this(), _1));
     }
     else if (!result)
     {
       reply_ = reply::stock_reply(reply::bad_request);
-      asio::async_write(socket_, reply_.to_buffers(),
-          boost::bind(&connection::handle_write, shared_from_this(),
-            asio::placeholders::error));
+      boost::asio::async_write(socket_, reply_.to_buffers(),
+          boost::bind(&connection::handle_write, shared_from_this(), _1));
     }
     else
     {
-      socket_.async_read_some(asio::buffer(buffer_),
-          boost::bind(&connection::handle_read, shared_from_this(),
-            asio::placeholders::error,
-            asio::placeholders::bytes_transferred));
+      socket_.async_read_some(boost::asio::buffer(buffer_),
+          boost::bind(&connection::handle_read, shared_from_this(), _1, _2));
     }
   }
 
@@ -88,7 +83,7 @@ void connection::handle_write(const boos
   {
     // Initiate graceful connection closure.
     boost::system::error_code ignored_ec;
-    socket_.shutdown(asio::ip::tcp::socket::shutdown_both, ignored_ec);
+    socket_.shutdown(boost::asio::ip::tcp::socket::shutdown_both, ignored_ec);
   }
 
   // No new asynchronous operations are started. This means that all shared_ptr
diff '--color=auto' -urNp openscenegraph-3.6.5-orig/src/osgPlugins/RestHttpDevice/connection.hpp openscenegraph-3.6.5-dwok/src/osgPlugins/RestHttpDevice/connection.hpp
--- openscenegraph-3.6.5-orig/src/osgPlugins/RestHttpDevice/connection.hpp	2024-12-27 12:34:55.469783593 +0100
+++ openscenegraph-3.6.5-dwok/src/osgPlugins/RestHttpDevice/connection.hpp	2024-12-27 12:40:08.523007514 +0100
@@ -33,7 +33,7 @@ class connection
 {
 public:
   /// Construct a connection with the given io_service.
-  explicit connection(asio::io_service& io_service,
+  explicit connection(boost::asio::io_context& io_context,
       request_handler& handler);
 
   /// Get the socket associated with the connection.
diff '--color=auto' -urNp openscenegraph-3.6.5-orig/src/osgPlugins/RestHttpDevice/io_service_pool.cpp openscenegraph-3.6.5-dwok/src/osgPlugins/RestHttpDevice/io_service_pool.cpp
--- openscenegraph-3.6.5-orig/src/osgPlugins/RestHttpDevice/io_service_pool.cpp	2024-12-27 12:34:55.469783593 +0100
+++ openscenegraph-3.6.5-dwok/src/osgPlugins/RestHttpDevice/io_service_pool.cpp	2024-12-27 12:48:08.654997383 +0100
@@ -8,16 +8,18 @@
 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 //
 
-#include "server.hpp"
+#include "io_service_pool.hpp"
 #include <stdexcept>
-#include <boost/bind.hpp>
+#include <boost/bind/bind.hpp>
+using namespace boost::placeholders;
+#include <boost/shared_ptr.hpp>
 #include <boost/thread.hpp>
 
 namespace http {
 namespace server {
 
 io_service_pool::io_service_pool(std::size_t pool_size)
-  : next_io_service_(0)
+  : next_io_context_(0)
 {
   if (pool_size == 0)
     throw std::runtime_error("io_service_pool size is 0");
@@ -26,9 +28,9 @@ io_service_pool::io_service_pool(std::si
   // exit until they are explicitly stopped.
   for (std::size_t i = 0; i < pool_size; ++i)
   {
-    io_service_ptr io_service(new asio::io_service);
-    work_ptr work(new asio::io_service::work(*io_service));
-    io_services_.push_back(io_service);
+    io_context_ptr io_context(new boost::asio::io_context);
+    work_ptr work(new boost::asio::executor_work_guard<boost::asio::io_context::executor_type>(boost::asio::make_work_guard(*io_context)));
+    io_contexts_.push_back(io_context);
     work_.push_back(work);
   }
 }
@@ -36,31 +38,34 @@ io_service_pool::io_service_pool(std::si
 void io_service_pool::run()
 {
   // Create a pool of threads to run all of the io_services.
-  std::vector<thread> threads;
-  for (std::size_t i = 0; i < io_services_.size(); ++i)
-    threads.emplace_back(thread(boost::bind(&asio::io_service::run,
-                                            io_services_[i])));
+  std::vector<boost::shared_ptr<boost::thread>> threads;
+  for (std::size_t i = 0; i < io_contexts_.size(); ++i)
+  {
+    boost::shared_ptr<boost::thread> thread(new boost::thread(
+      boost::bind(&boost::asio::io_context::run, io_contexts_[i])));
+    threads.push_back(thread);
+  }
 
   // Wait for all threads in the pool to exit.
   for (std::size_t i = 0; i < threads.size(); ++i)
-    threads[i].join();
+    threads[i]->join();
 }
 
 void io_service_pool::stop()
 {
   // Explicitly stop all io_services.
-  for (std::size_t i = 0; i < io_services_.size(); ++i)
-    io_services_[i]->stop();
+  for (std::size_t i = 0; i < io_contexts_.size(); ++i)
+    io_contexts_[i]->stop();
 }
 
-asio::io_service& io_service_pool::get_io_service()
+boost::asio::io_context& io_service_pool::get_io_context()
 {
   // Use a round-robin scheme to choose the next io_service to use.
-  asio::io_service& io_service = *io_services_[next_io_service_];
-  ++next_io_service_;
-  if (next_io_service_ == io_services_.size())
-    next_io_service_ = 0;
-  return io_service;
+  boost::asio::io_context& io_context = *io_contexts_[next_io_context_];
+  ++next_io_context_;
+  if (next_io_context_ == io_contexts_.size())
+    next_io_context_ = 0;
+  return io_context;
 }
 
 } // namespace server
diff '--color=auto' -urNp openscenegraph-3.6.5-orig/src/osgPlugins/RestHttpDevice/io_service_pool.hpp openscenegraph-3.6.5-dwok/src/osgPlugins/RestHttpDevice/io_service_pool.hpp
--- openscenegraph-3.6.5-orig/src/osgPlugins/RestHttpDevice/io_service_pool.hpp	2024-12-27 12:34:55.469783593 +0100
+++ openscenegraph-3.6.5-dwok/src/osgPlugins/RestHttpDevice/io_service_pool.hpp	2024-12-27 12:40:08.523007514 +0100
@@ -16,8 +16,6 @@
 #include <boost/noncopyable.hpp>
 #include <boost/shared_ptr.hpp>
 
-using namespace boost;
-
 namespace http {
 namespace server {
 
@@ -36,20 +34,20 @@ public:
   void stop();
 
   /// Get an io_service to use.
-  asio::io_service& get_io_service();
+  boost::asio::io_context& get_io_context();
 
 private:
-  typedef boost::shared_ptr<asio::io_service> io_service_ptr;
-  typedef boost::shared_ptr<asio::io_service::work> work_ptr;
+  typedef boost::shared_ptr<boost::asio::io_context> io_context_ptr;
+  typedef boost::shared_ptr<boost::asio::executor_work_guard<boost::asio::io_context::executor_type>> work_ptr;
 
   /// The pool of io_services.
-  std::vector<io_service_ptr> io_services_;
+  std::vector<io_context_ptr> io_contexts_;
 
   /// The work that keeps the io_services running.
   std::vector<work_ptr> work_;
 
   /// The next io_service to use for a connection.
-  std::size_t next_io_service_;
+  std::size_t next_io_context_;
 };
 
 } // namespace server
diff '--color=auto' -urNp openscenegraph-3.6.5-orig/src/osgPlugins/RestHttpDevice/ReaderWriterRestHttpDevice.cpp openscenegraph-3.6.5-dwok/src/osgPlugins/RestHttpDevice/ReaderWriterRestHttpDevice.cpp
--- openscenegraph-3.6.5-orig/src/osgPlugins/RestHttpDevice/ReaderWriterRestHttpDevice.cpp	2024-12-27 12:34:55.469783593 +0100
+++ openscenegraph-3.6.5-dwok/src/osgPlugins/RestHttpDevice/ReaderWriterRestHttpDevice.cpp	2024-12-27 12:49:01.143868489 +0100
@@ -35,6 +35,8 @@
 #include <osgDB/FileNameUtils>
 #include <osgDB/FileUtils>
 #include "RestHttpDevice.hpp"
+#include <boost/bind/bind.hpp>
+using namespace boost::placeholders;
 
 
 
diff '--color=auto' -urNp openscenegraph-3.6.5-orig/src/osgPlugins/RestHttpDevice/RestHttpDevice.cpp openscenegraph-3.6.5-dwok/src/osgPlugins/RestHttpDevice/RestHttpDevice.cpp
--- openscenegraph-3.6.5-orig/src/osgPlugins/RestHttpDevice/RestHttpDevice.cpp	2024-12-27 12:34:55.469783593 +0100
+++ openscenegraph-3.6.5-dwok/src/osgPlugins/RestHttpDevice/RestHttpDevice.cpp	2024-12-27 12:48:44.131586152 +0100
@@ -16,6 +16,8 @@
 #include <osg/ValueObject>
 #include <osgDB/FileUtils>
 #include "request_handler.hpp"
+#include <boost/bind/bind.hpp>
+using namespace boost::placeholders;
 
 namespace RestHttp {
 
diff '--color=auto' -urNp openscenegraph-3.6.5-orig/src/osgPlugins/RestHttpDevice/server.cpp openscenegraph-3.6.5-dwok/src/osgPlugins/RestHttpDevice/server.cpp
--- openscenegraph-3.6.5-orig/src/osgPlugins/RestHttpDevice/server.cpp	2024-12-27 12:34:55.469783593 +0100
+++ openscenegraph-3.6.5-dwok/src/osgPlugins/RestHttpDevice/server.cpp	2024-12-27 12:47:11.326045994 +0100
@@ -9,7 +9,8 @@
 //
 
 #include "server.hpp"
-#include <boost/bind.hpp>
+#include <boost/bind/bind.hpp>
+using namespace boost::placeholders;
 
 namespace http {
 namespace server {
@@ -17,22 +18,21 @@ namespace server {
 server::server(const std::string& address, const std::string& port,
     const std::string& doc_root, std::size_t io_service_pool_size)
   : io_service_pool_(io_service_pool_size),
-    acceptor_(io_service_pool_.get_io_service()),
+    acceptor_(io_service_pool_.get_io_context()),
     new_connection_(new connection(
-          io_service_pool_.get_io_service(), request_handler_)),
+          io_service_pool_.get_io_context(), request_handler_)),
     request_handler_(doc_root)
 {
   // Open the acceptor with the option to reuse the address (i.e. SO_REUSEADDR).
-  asio::ip::tcp::resolver resolver(io_service_pool_.get_io_service());
-  asio::ip::tcp::resolver::query query(address, port);
-  asio::ip::tcp::endpoint endpoint = *resolver.resolve(query);
+  boost::asio::ip::tcp::resolver resolver(io_service_pool_.get_io_context());
+  boost::asio::ip::tcp::resolver::results_type endpoints = resolver.resolve(address, port);
+  boost::asio::ip::tcp::endpoint endpoint = *endpoints.begin();
   acceptor_.open(endpoint.protocol());
-  acceptor_.set_option(asio::ip::tcp::acceptor::reuse_address(true));
+  acceptor_.set_option(boost::asio::ip::tcp::acceptor::reuse_address(true));
   acceptor_.bind(endpoint);
   acceptor_.listen();
   acceptor_.async_accept(new_connection_->socket(),
-      boost::bind(&server::handle_accept, this,
-        asio::placeholders::error));
+      boost::bind(&server::handle_accept, this, _1));
 }
 
 void server::run()
@@ -54,10 +54,9 @@ void server::handle_accept(const boost::
     OSG_DEBUG << "RestHttpDevice :: server::handle_accept" << std::endl;
     new_connection_->start();
     new_connection_.reset(new connection(
-          io_service_pool_.get_io_service(), request_handler_));
+          io_service_pool_.get_io_context(), request_handler_));
     acceptor_.async_accept(new_connection_->socket(),
-        boost::bind(&server::handle_accept, this,
-          asio::placeholders::error));
+        boost::bind(&server::handle_accept, this, _1));
   }
   else
   {