@@ -102,20 +102,10 @@ namespace dsl {
102102 // / If the packet is valid (it contains data)
103103 bool valid{false };
104104
105- struct Target {
106- Target () = default ;
107- Target (std::string address, const uint16_t & port) : address(std::move(address)), port(port) {}
108-
109- // / The address of the target
110- std::string address;
111- // / The port of the target
112- uint16_t port{0 };
113- };
114-
115105 // / The information about this packets destination
116- Target local;
106+ util::network:: sock_t local{} ;
117107 // / The information about this packets source
118- Target remote;
108+ util::network:: sock_t remote{} ;
119109
120110 // / The data to be sent in the packet
121111 std::vector<uint8_t > payload;
@@ -427,12 +417,10 @@ namespace dsl {
427417 RecvResult result = read<DSL>(task);
428418
429419 Packet p{};
430- p.valid = result.valid ;
431- p.payload = std::move (result.payload );
432- auto local_s = result.local .address ();
433- auto remote_s = result.remote .address ();
434- p.local = Packet::Target{local_s.first , local_s.second };
435- p.remote = Packet::Target{remote_s.first , remote_s.second };
420+ p.valid = result.valid ;
421+ p.payload = std::move (result.payload );
422+ p.local = result.local ;
423+ p.remote = result.remote ;
436424
437425 // Confirm that this packet was sent to one of our local addresses
438426 for (const auto & iface : util::network::get_interfaces ()) {
@@ -475,12 +463,10 @@ namespace dsl {
475463 if (result.local .sock .sa_family == AF_INET) {
476464
477465 Packet p{};
478- p.valid = result.valid ;
479- p.payload = std::move (result.payload );
480- auto local_s = result.local .address ();
481- auto remote_s = result.remote .address ();
482- p.local = Packet::Target{local_s.first , local_s.second };
483- p.remote = Packet::Target{remote_s.first , remote_s.second };
466+ p.valid = result.valid ;
467+ p.payload = std::move (result.payload );
468+ p.local = result.local ;
469+ p.remote = result.remote ;
484470
485471 // 255.255.255.255 is always a valid broadcast address
486472 if (result.local .ipv4 .sin_addr .s_addr == htonl (INADDR_BROADCAST)) {
@@ -526,12 +512,10 @@ namespace dsl {
526512 // Only return multicast packets
527513 if (multicast) {
528514 Packet p{};
529- p.valid = result.valid ;
530- p.payload = std::move (result.payload );
531- auto local_s = result.local .address ();
532- auto remote_s = result.remote .address ();
533- p.local = Packet::Target{local_s.first , local_s.second };
534- p.remote = Packet::Target{remote_s.first , remote_s.second };
515+ p.valid = result.valid ;
516+ p.payload = std::move (result.payload );
517+ p.local = result.local ;
518+ p.remote = result.remote ;
535519 return p;
536520 }
537521
0 commit comments