Skip to content

Commit

Permalink
Merge pull request #78 from mauriciovasquezbernal/pr/cleanup_base_cube
Browse files Browse the repository at this point in the history
libpolycube: remove dead code in cube
  • Loading branch information
mauriciovasquezbernal committed Mar 6, 2019
2 parents 2063ac8 + 986261b commit 5dac92c
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 34 deletions.
4 changes: 0 additions & 4 deletions src/libs/polycube/include/polycube/services/base_cube.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,6 @@ class BaseCube {
const std::string &table_name, int index = 0,
ProgramType type = ProgramType::INGRESS);

// virtual void packet_in(PortType &port, PacketInMetadata &md,
// const std::vector<uint8_t> &packet) = 0;

virtual void datapath_log_msg(const LogMsg *msg);

void set_log_level(LogLevel level);
Expand All @@ -94,7 +91,6 @@ class BaseCube {
int get_table_fd(const std::string &table_name, int index, ProgramType type);

std::shared_ptr<BaseCubeIface> cube_; // pointer to the cube in polycubed
// packet_in_cb handle_packet_in;
log_msg_cb handle_log_msg;
CubeType type_;
std::shared_ptr<spdlog::logger> logger_;
Expand Down
29 changes: 0 additions & 29 deletions src/libs/polycube/src/base_cube.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,40 +31,12 @@ BaseCube::BaseCube(const std::string &name,
logfile_, 1048576 * 5, 3),
std::make_shared<spdlog::sinks::stdout_sink_mt>()})) {
logger()->set_level(logLevelToSPDLog(level));
// TODO: move to function
/*
handle_packet_in = [&](const PacketIn *md,
const std::vector<uint8_t> &packet) -> void {
// This lock guarantees:
// - port is not deleted while processing it
// - service implementation is not deleted wile processing it
std::lock_guard<std::mutex> guard(cube_mutex);
if (dismounted_)
return;
auto &p = *ports_by_id_.at(md->port_id);
PacketInMetadata md_;
md_.reason = md->reason;
md_.metadata[0] = md->metadata[0];
md_.metadata[1] = md->metadata[1];
md_.metadata[2] = md->metadata[2];
packet_in(p, md_, packet);
};
*/

handle_log_msg = [&](const LogMsg *msg) -> void { datapath_log_msg(msg); };

// TODO: where to create cube?, here or in derived classes?
// cube_ = factory_->create_cube(name, ingress_code, egress_code,
// handle_log_msg, type, handle_packet_in,
// level);
}

BaseCube::~BaseCube() {
// just in case
dismount();

// factory_->destroy_cube(get_name());
}

int BaseCube::get_table_fd(const std::string &table_name, int index,
Expand Down Expand Up @@ -152,7 +124,6 @@ void BaseCube::dismount() {

dismounted_ = true;
// invalidate handlers
// handle_packet_in = nullptr;
handle_log_msg = nullptr;

// TODO: remove from controller and datapathlog?
Expand Down
2 changes: 1 addition & 1 deletion src/libs/polycube/src/transparent_cube.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ TransparentCube::~TransparentCube() {
// just in case
dismount();

// handle_packet_in = nullptr;
handle_packet_in = nullptr;

factory_->destroy_cube(get_name());
}
Expand Down

0 comments on commit 5dac92c

Please sign in to comment.