Ticket #3958: asio_ssl_strand.patch
File asio_ssl_strand.patch, 2.8 KB (added by , 12 years ago) |
---|
-
boost/asio/ssl/detail/openssl_stream_service.hpp
161 161 ::SSL* ssl; 162 162 ::BIO* ext_bio; 163 163 net_buffer recv_buf; 164 boost::asio::io_service::strand* strand; 164 165 } * impl_type; 165 166 166 167 // Construct a new stream socket service for the specified io_service. 167 168 explicit openssl_stream_service(boost::asio::io_service& io_service) 168 : boost::asio::detail::service_base<openssl_stream_service>(io_service), 169 strand_(io_service) 169 : boost::asio::detail::service_base<openssl_stream_service>(io_service) 170 170 { 171 171 } 172 172 … … 194 194 impl->ext_bio = 0; 195 195 ::BIO_new_bio_pair(&int_bio, 8192, &impl->ext_bio, 8192); 196 196 ::SSL_set_bio(impl->ssl, int_bio, int_bio); 197 impl->strand = new boost::asio::io_service::strand(get_io_service()); 197 198 } 198 199 199 200 // Destroy a stream implementation. … … 204 205 { 205 206 ::BIO_free(impl->ext_bio); 206 207 ::SSL_free(impl->ssl); 208 delete impl->strand; 207 209 delete impl; 208 210 impl = 0; 209 211 } … … 262 264 boost::arg<1>(), 263 265 boost::arg<2>() 264 266 ), 265 strand_267 *(impl->strand) 266 268 ); 267 269 local_handler->set_operation(op); 268 270 269 strand_.post(boost::bind(&openssl_operation<Stream>::start, op));271 impl->strand->post(boost::bind(&openssl_operation<Stream>::start, op)); 270 272 } 271 273 272 274 // Shut down SSL on the stream. … … 317 319 boost::arg<1>(), 318 320 boost::arg<2>() 319 321 ), 320 strand_322 *(impl->strand) 321 323 ); 322 324 local_handler->set_operation(op); 323 325 324 strand_.post(boost::bind(&openssl_operation<Stream>::start, op));326 impl->strand->post(boost::bind(&openssl_operation<Stream>::start, op)); 325 327 } 326 328 327 329 // Write some data to the stream. … … 410 412 boost::arg<1>(), 411 413 boost::arg<2>() 412 414 ), 413 strand_415 *(impl->strand) 414 416 ); 415 417 local_handler->set_operation(op); 416 418 417 strand_.post(boost::bind(&openssl_operation<Stream>::start, op));419 impl->strand->post(boost::bind(&openssl_operation<Stream>::start, op)); 418 420 } 419 421 420 422 // Read some data from the stream. … … 503 505 boost::arg<1>(), 504 506 boost::arg<2>() 505 507 ), 506 strand_508 *(impl->strand) 507 509 ); 508 510 local_handler->set_operation(op); 509 511 510 strand_.post(boost::bind(&openssl_operation<Stream>::start, op));512 impl->strand->post(boost::bind(&openssl_operation<Stream>::start, op)); 511 513 } 512 514 513 515 // Peek at the incoming data on the stream. … … 529 531 } 530 532 531 533 private: 532 boost::asio::io_service::strand strand_;533 534 534 typedef boost::asio::detail::mutex mutex_type; 535 535 536 536 template<typename Mutex>