aboutsummaryrefslogtreecommitdiffstats
path: root/libtransport/src/hicn/transport/core/raw_socket_connector.cc
diff options
context:
space:
mode:
Diffstat (limited to 'libtransport/src/hicn/transport/core/raw_socket_connector.cc')
-rw-r--r--libtransport/src/hicn/transport/core/raw_socket_connector.cc18
1 files changed, 11 insertions, 7 deletions
diff --git a/libtransport/src/hicn/transport/core/raw_socket_connector.cc b/libtransport/src/hicn/transport/core/raw_socket_connector.cc
index 12cc4e0..0e17436 100644
--- a/libtransport/src/hicn/transport/core/raw_socket_connector.cc
+++ b/libtransport/src/hicn/transport/core/raw_socket_connector.cc
@@ -115,11 +115,17 @@ void RawSocketConnector::connect(const std::string &interface_name,
void RawSocketConnector::send(const uint8_t *packet, std::size_t len,
const PacketSentCallback &packet_sent) {
- // asio::async_write(socket_, asio::buffer(packet, len),
- // [packet_sent] (std::error_code ec,
- // std::size_t /*length*/) {
- // packet_sent();
- // });
+ if (packet_sent != 0) {
+ socket_.async_send(
+ asio::buffer(packet, len),
+ [packet_sent](std::error_code ec, std::size_t /*length*/) {
+ packet_sent();
+ });
+ } else {
+ if (state_ == ConnectorState::CONNECTED) {
+ socket_.send(asio::buffer(packet, len));
+ }
+ }
}
void RawSocketConnector::send(const Packet::MemBufPtr &packet) {
@@ -191,8 +197,6 @@ void RawSocketConnector::doConnect() {
socket_.bind(raw_endpoint(&link_layer_address_, sizeof(link_layer_address_)));
}
-void RawSocketConnector::enableBurst() { return; }
-
} // end namespace core
} // end namespace transport