Skip to content

Commit

Permalink
Simplify DNS server implementation.
Browse files Browse the repository at this point in the history
  • Loading branch information
Barenboim committed Feb 8, 2025
1 parent a62f170 commit 0c74754
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/factory/DnsTaskImpl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -217,10 +217,31 @@ class WFDnsServerTask : public WFServerTask<DnsRequest, DnsResponse>
return this->WFServerTask::message_out();
}

virtual void handle(int state, int error);

protected:
enum TransportType type;
};

void WFDnsServerTask::handle(int state, int error)
{
if (state == WFT_STATE_TOREPLY)
{
DnsRequest *req = this->get_req();
DnsResponse *resp = this->get_resp();

resp->set_question_name(req->get_question_name());
resp->set_question_type(req->get_question_type());
resp->set_question_class(req->get_question_class());
resp->set_opcode(req->get_opcode());
resp->set_id(req->get_id());
resp->set_rd(req->get_rd());
resp->set_qr(1);
}

return WFServerTask::handle(state, error);
}

/**********Server Factory**********/

WFDnsTask *WFServerTaskFactory::create_dns_task(CommService *service,
Expand Down

0 comments on commit 0c74754

Please sign in to comment.