diff options
-rw-r--r-- | apps/http-proxy/main.cc | 19 | ||||
-rw-r--r-- | apps/http-proxy/src/ATSConnector.cc | 3 | ||||
-rw-r--r-- | apps/http-proxy/src/IcnReceiver.cc | 11 | ||||
-rw-r--r-- | apps/http-proxy/src/IcnReceiver.h | 3 | ||||
-rw-r--r-- | hicn-plugin/src/pcs.h | 6 | ||||
-rw-r--r-- | libtransport/src/hicn/transport/interfaces/socket_consumer.cc | 9 |
6 files changed, 33 insertions, 18 deletions
diff --git a/apps/http-proxy/main.cc b/apps/http-proxy/main.cc index 0dedbd8a7..a7020298b 100644 --- a/apps/http-proxy/main.cc +++ b/apps/http-proxy/main.cc @@ -19,9 +19,9 @@ using namespace transport; int usage(char* program) { std::cerr << "ICN Plugin not loaded!" << std::endl; - std::cerr << "USAGE: " << program + std::cerr << "USAGE: " << program << "\n" << "[HTTP_PREFIX] -a [SERVER_IP_ADDRESS] " - "-p [SERVER_PORT] -c [CACHE_SIZE]" + "-p [SERVER_PORT] -c [CACHE_SIZE] -m [MTU]" << std::endl; return -1; } @@ -31,12 +31,13 @@ int main(int argc, char** argv) { std::string ip_address("127.0.0.1"); std::string port("80"); std::string cache_size("50000"); + std::string mtu("1500"); int opt; - while ((opt = getopt(argc, argv, "a:p:c:")) != -1) { + while ((opt = getopt(argc, argv, "a:p:c:m:")) != -1) { switch (opt) { case 'a': - prefix = optarg; + ip_address = optarg; break; case 'p': port = optarg; @@ -44,6 +45,9 @@ int main(int argc, char** argv) { case 'c': cache_size = optarg; break; + case 'm': + mtu = optarg; + break; case 'h': default: return usage(argv[0]); @@ -58,9 +62,10 @@ int main(int argc, char** argv) { } std::cout << "Connecting to " << ip_address << " port " << port - << " Cache size " << cache_size << " Prefix " << prefix - << std::endl; - transport::AsyncConsumerProducer proxy(prefix, ip_address, port, cache_size); + << " Cache size " << cache_size << " Prefix " << prefix << " MTU " + << mtu << std::endl; + transport::AsyncConsumerProducer proxy(prefix, ip_address, port, cache_size, + mtu); proxy.run(); diff --git a/apps/http-proxy/src/ATSConnector.cc b/apps/http-proxy/src/ATSConnector.cc index 287907347..a1c8c9708 100644 --- a/apps/http-proxy/src/ATSConnector.cc +++ b/apps/http-proxy/src/ATSConnector.cc @@ -193,7 +193,8 @@ void ATSConnector::doConnect() { } } else { - TRANSPORT_LOGE("Impossible to reconnect."); + TRANSPORT_LOGE("Impossible to reconnect: %s", + ec.message().c_str()); close(); } }); diff --git a/apps/http-proxy/src/IcnReceiver.cc b/apps/http-proxy/src/IcnReceiver.cc index 4ad616168..fc6837a2c 100644 --- a/apps/http-proxy/src/IcnReceiver.cc +++ b/apps/http-proxy/src/IcnReceiver.cc @@ -55,12 +55,14 @@ core::Prefix generatePrefix(const std::string& prefix_url) { AsyncConsumerProducer::AsyncConsumerProducer(const std::string& prefix, std::string& ip_address, std::string& port, - std::string& cache_size) + std::string& cache_size, + std::string& mtu) : prefix_(generatePrefix(prefix)), producer_socket_(), ip_address_(ip_address), port_(port), cache_size_(std::stoul(cache_size)), + mtu_(std::stoul(mtu)), request_counter_(0), signals_(io_service_, SIGINT, SIGQUIT), connector_(io_service_, ip_address_, port_, @@ -78,6 +80,13 @@ AsyncConsumerProducer::AsyncConsumerProducer(const std::string& prefix, TRANSPORT_LOGD("Warning: output buffer size has not been set."); } + ret = producer_socket_.setSocketOption( + interface::GeneralTransportOptions::DATA_PACKET_SIZE, mtu_); + + if (ret != SOCKET_OPTION_SET) { + TRANSPORT_LOGD("Warning: mtu has not been set."); + } + producer_socket_.registerPrefix(prefix_); // Let the main thread to catch SIGINT and SIGQUIT diff --git a/apps/http-proxy/src/IcnReceiver.h b/apps/http-proxy/src/IcnReceiver.h index 7d5c5e4c8..61ca4333a 100644 --- a/apps/http-proxy/src/IcnReceiver.h +++ b/apps/http-proxy/src/IcnReceiver.h @@ -31,7 +31,7 @@ class AsyncConsumerProducer { public: explicit AsyncConsumerProducer(const std::string& prefix, std::string& ip_address, std::string& port, - std::string& cache_size); + std::string& cache_size, std::string& mtu); void start(); @@ -55,6 +55,7 @@ class AsyncConsumerProducer { std::string ip_address_; std::string port_; uint32_t cache_size_; + uint32_t mtu_; uint64_t request_counter_; asio::signal_set signals_; diff --git a/hicn-plugin/src/pcs.h b/hicn-plugin/src/pcs.h index 549edae01..f87cccf8a 100644 --- a/hicn-plugin/src/pcs.h +++ b/hicn-plugin/src/pcs.h @@ -495,14 +495,16 @@ hicn_pcs_cs_delete (vlib_main_t * vm, hicn_pit_cs_t * pitcs, /* Update the global CS counter */ pitcs->pcs_cs_count--; } - hash_entry->locks--; - if (hash_entry->locks == 0) + + /* A data could have been inserted in the CS through a push. In this case locks == 0 */ + if (hash_entry->locks == 0 || hash_entry->locks == 1) { hicn_pcs_delete_internal (pitcs, pcs_entryp, hash_entry, nodep, vm, dpo_vft, hicn_dpo_id); } else { + hash_entry->locks--; hash_entry->he_flags |= HICN_HASH_ENTRY_FLAG_DELETED; } } diff --git a/libtransport/src/hicn/transport/interfaces/socket_consumer.cc b/libtransport/src/hicn/transport/interfaces/socket_consumer.cc index af99fd60c..e1afd2161 100644 --- a/libtransport/src/hicn/transport/interfaces/socket_consumer.cc +++ b/libtransport/src/hicn/transport/interfaces/socket_consumer.cc @@ -123,12 +123,9 @@ void ConsumerSocket::asyncSendInterest(Interest::Ptr &&interest, } void ConsumerSocket::stop() { - auto &io_service = getIoService(); - io_service.dispatch([this]() { - if (transport_protocol_->isRunning()) { - transport_protocol_->stop(); - } - }); + if (transport_protocol_->isRunning()) { + transport_protocol_->stop(); + } } void ConsumerSocket::resume() { |