diff --git a/Datagram.cpp b/Datagram.cpp index baace10e..279a3033 100644 --- a/Datagram.cpp +++ b/Datagram.cpp @@ -38,7 +38,7 @@ namespace datagram auto service = m_Owner.GetService (); if (service) - service->post (boost::bind (&DatagramDestination::SendMsg, this, + service->post (std::bind (&DatagramDestination::SendMsg, this, CreateDataMessage (buf, len + headerLen), remote)); else LogPrint (eLogWarning, "Failed to send datagram. Destination is not running"); diff --git a/Destination.cpp b/Destination.cpp index e90d214e..bfb0659e 100644 --- a/Destination.cpp +++ b/Destination.cpp @@ -190,12 +190,12 @@ namespace client void ClientDestination::ProcessGarlicMessage (I2NPMessage * msg) { - m_Service->post (boost::bind (&ClientDestination::HandleGarlicMessage, this, msg)); + m_Service->post (std::bind (&ClientDestination::HandleGarlicMessage, this, msg)); } void ClientDestination::ProcessDeliveryStatusMessage (I2NPMessage * msg) { - m_Service->post (boost::bind (&ClientDestination::HandleDeliveryStatusMessage, this, msg)); + m_Service->post (std::bind (&ClientDestination::HandleDeliveryStatusMessage, this, msg)); } void ClientDestination::HandleI2NPMessage (const uint8_t * buf, size_t len, i2p::tunnel::InboundTunnel * from) diff --git a/SAM.cpp b/SAM.cpp index c02d2583..e67a494e 100644 --- a/SAM.cpp +++ b/SAM.cpp @@ -3,7 +3,6 @@ #ifdef _MSC_VER #include <stdlib.h> #endif -#include <boost/bind.hpp> #include "base64.h" #include "Identity.h" #include "Log.h" @@ -72,8 +71,8 @@ namespace client void SAMSocket::ReceiveHandshake () { m_Socket.async_read_some (boost::asio::buffer(m_Buffer, SAM_SOCKET_BUFFER_SIZE), - boost::bind(&SAMSocket::HandleHandshakeReceived, shared_from_this (), - boost::asio::placeholders::error, boost::asio::placeholders::bytes_transferred)); + std::bind(&SAMSocket::HandleHandshakeReceived, shared_from_this (), + std::placeholders::_1, std::placeholders::_2)); } void SAMSocket::HandleHandshakeReceived (const boost::system::error_code& ecode, std::size_t bytes_transferred) @@ -92,8 +91,8 @@ namespace client { // TODO: check version boost::asio::async_write (m_Socket, boost::asio::buffer (SAM_HANDSHAKE_REPLY, strlen (SAM_HANDSHAKE_REPLY)), boost::asio::transfer_all (), - boost::bind(&SAMSocket::HandleHandshakeReplySent, shared_from_this (), - boost::asio::placeholders::error, boost::asio::placeholders::bytes_transferred)); + std::bind(&SAMSocket::HandleHandshakeReplySent, shared_from_this (), + std::placeholders::_1, std::placeholders::_2)); } else { @@ -114,8 +113,8 @@ namespace client else { m_Socket.async_read_some (boost::asio::buffer(m_Buffer, SAM_SOCKET_BUFFER_SIZE), - boost::bind(&SAMSocket::HandleMessage, shared_from_this (), - boost::asio::placeholders::error, boost::asio::placeholders::bytes_transferred)); + std::bind(&SAMSocket::HandleMessage, shared_from_this (), + std::placeholders::_1, std::placeholders::_2)); } } @@ -123,8 +122,8 @@ namespace client { if (!m_IsSilent || m_SocketType == eSAMSocketTypeAcceptor) boost::asio::async_write (m_Socket, boost::asio::buffer (msg, len), boost::asio::transfer_all (), - boost::bind(&SAMSocket::HandleMessageReplySent, shared_from_this (), - boost::asio::placeholders::error, boost::asio::placeholders::bytes_transferred, close)); + std::bind(&SAMSocket::HandleMessageReplySent, shared_from_this (), + std::placeholders::_1, std::placeholders::_2, close)); else { if (close) @@ -237,8 +236,8 @@ namespace client else { m_Timer.expires_from_now (boost::posix_time::seconds(SAM_SESSION_READINESS_CHECK_INTERVAL)); - m_Timer.async_wait (boost::bind (&SAMSocket::HandleSessionReadinessCheckTimer, - shared_from_this (), boost::asio::placeholders::error)); + m_Timer.async_wait (std::bind (&SAMSocket::HandleSessionReadinessCheckTimer, + shared_from_this (), std::placeholders::_1)); } } else @@ -254,8 +253,8 @@ namespace client else { m_Timer.expires_from_now (boost::posix_time::seconds(SAM_SESSION_READINESS_CHECK_INTERVAL)); - m_Timer.async_wait (boost::bind (&SAMSocket::HandleSessionReadinessCheckTimer, - shared_from_this (), boost::asio::placeholders::error)); + m_Timer.async_wait (std::bind (&SAMSocket::HandleSessionReadinessCheckTimer, + shared_from_this (), std::placeholders::_1)); } } } @@ -299,8 +298,8 @@ namespace client { i2p::data::netdb.RequestDestination (dest.GetIdentHash (), true, m_Session->localDestination->GetTunnelPool ()); m_Timer.expires_from_now (boost::posix_time::seconds(SAM_CONNECT_TIMEOUT)); - m_Timer.async_wait (boost::bind (&SAMSocket::HandleStreamDestinationRequestTimer, - shared_from_this (), boost::asio::placeholders::error, dest.GetIdentHash ())); + m_Timer.async_wait (std::bind (&SAMSocket::HandleStreamDestinationRequestTimer, + shared_from_this (), std::placeholders::_1, dest.GetIdentHash ())); } } else @@ -422,8 +421,8 @@ namespace client { i2p::data::netdb.RequestDestination (ident, true, m_Session->localDestination->GetTunnelPool ()); m_Timer.expires_from_now (boost::posix_time::seconds(SAM_NAMING_LOOKUP_TIMEOUT)); - m_Timer.async_wait (boost::bind (&SAMSocket::HandleNamingLookupDestinationRequestTimer, - shared_from_this (), boost::asio::placeholders::error, ident)); + m_Timer.async_wait (std::bind (&SAMSocket::HandleNamingLookupDestinationRequestTimer, + shared_from_this (), std::placeholders::_1, ident)); } } else @@ -475,8 +474,8 @@ namespace client void SAMSocket::Receive () { m_Socket.async_read_some (boost::asio::buffer(m_Buffer, SAM_SOCKET_BUFFER_SIZE), - boost::bind((m_SocketType == eSAMSocketTypeSession) ? &SAMSocket::HandleMessage : &SAMSocket::HandleReceived, - shared_from_this (), boost::asio::placeholders::error, boost::asio::placeholders::bytes_transferred)); + std::bind((m_SocketType == eSAMSocketTypeSession) ? &SAMSocket::HandleMessage : &SAMSocket::HandleReceived, + shared_from_this (), std::placeholders::_1, std::placeholders::_2)); } void SAMSocket::HandleReceived (const boost::system::error_code& ecode, std::size_t bytes_transferred) @@ -499,8 +498,8 @@ namespace client { if (m_Stream) m_Stream->AsyncReceive (boost::asio::buffer (m_StreamBuffer, SAM_SOCKET_BUFFER_SIZE), - boost::bind (&SAMSocket::HandleI2PReceive, shared_from_this (), - boost::asio::placeholders::error, boost::asio::placeholders::bytes_transferred), + std::bind (&SAMSocket::HandleI2PReceive, shared_from_this (), + std::placeholders::_1, std::placeholders::_2), SAM_SOCKET_CONNECTION_MAX_IDLE); } @@ -515,7 +514,7 @@ namespace client else { boost::asio::async_write (m_Socket, boost::asio::buffer (m_StreamBuffer, bytes_transferred), - boost::bind (&SAMSocket::HandleWriteI2PData, shared_from_this (), boost::asio::placeholders::error)); + std::bind (&SAMSocket::HandleWriteI2PData, shared_from_this (), std::placeholders::_1)); } } @@ -568,7 +567,7 @@ namespace client { memcpy (m_StreamBuffer + l2, buf, len); boost::asio::async_write (m_Socket, boost::asio::buffer (m_StreamBuffer, len + l2), - boost::bind (&SAMSocket::HandleWriteI2PData, shared_from_this (), boost::asio::placeholders::error)); + std::bind (&SAMSocket::HandleWriteI2PData, shared_from_this (), std::placeholders::_1)); } else LogPrint (eLogWarning, "Datagram size ", len," exceeds buffer"); @@ -624,8 +623,8 @@ namespace client void SAMBridge::Accept () { auto newSocket = std::make_shared<SAMSocket> (*this); - m_Acceptor.async_accept (newSocket->GetSocket (), boost::bind (&SAMBridge::HandleAccept, this, - boost::asio::placeholders::error, newSocket)); + m_Acceptor.async_accept (newSocket->GetSocket (), std::bind (&SAMBridge::HandleAccept, this, + std::placeholders::_1, newSocket)); } void SAMBridge::HandleAccept(const boost::system::error_code& ecode, std::shared_ptr<SAMSocket> socket) @@ -697,7 +696,7 @@ namespace client m_DatagramSocket.async_receive_from ( boost::asio::buffer (m_DatagramReceiveBuffer, i2p::datagram::MAX_DATAGRAM_SIZE), m_SenderEndpoint, - boost::bind (&SAMBridge::HandleReceivedDatagram, this, boost::asio::placeholders::error, boost::asio::placeholders::bytes_transferred)); + std::bind (&SAMBridge::HandleReceivedDatagram, this, std::placeholders::_1, std::placeholders::_2)); } void SAMBridge::HandleReceivedDatagram (const boost::system::error_code& ecode, std::size_t bytes_transferred) diff --git a/Streaming.cpp b/Streaming.cpp index 61aa03af..78a8f399 100644 --- a/Streaming.cpp +++ b/Streaming.cpp @@ -102,8 +102,8 @@ namespace stream { m_IsAckSendScheduled = true; m_AckSendTimer.expires_from_now (boost::posix_time::milliseconds(ACK_SEND_TIMEOUT)); - m_AckSendTimer.async_wait (boost::bind (&Stream::HandleAckSendTimer, - shared_from_this (), boost::asio::placeholders::error)); + m_AckSendTimer.async_wait (std::bind (&Stream::HandleAckSendTimer, + shared_from_this (), std::placeholders::_1)); } } else if (isSyn) @@ -309,7 +309,7 @@ namespace stream size += sentLen; // payload } p->len = size; - m_Service.post (boost::bind (&Stream::SendPacket, this, p)); + m_Service.post (std::bind (&Stream::SendPacket, this, p)); } return len; @@ -460,8 +460,8 @@ namespace stream { m_ResendTimer.cancel (); m_ResendTimer.expires_from_now (boost::posix_time::seconds(RESEND_TIMEOUT)); - m_ResendTimer.async_wait (boost::bind (&Stream::HandleResendTimer, - shared_from_this (), boost::asio::placeholders::error)); + m_ResendTimer.async_wait (std::bind (&Stream::HandleResendTimer, + shared_from_this (), std::placeholders::_1)); } void Stream::HandleResendTimer (const boost::system::error_code& ecode) diff --git a/Streaming.h b/Streaming.h index 005f00d0..ba9a40f7 100644 --- a/Streaming.h +++ b/Streaming.h @@ -9,7 +9,6 @@ #include <functional> #include <memory> #include <boost/asio.hpp> -#include <boost/bind.hpp> #include "I2PEndian.h" #include "Identity.h" #include "LeaseSet.h"