File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -43,7 +43,6 @@ Solo5Net::Solo5Net()
4343 mac_addr = MAC::Addr (solo5_net_mac_str ());
4444}
4545
46- #include < cstdlib>
4746void Solo5Net::transmit (net::Packet_ptr pckt)
4847{
4948 net::Packet_ptr tail = std::move (pckt);
@@ -53,12 +52,8 @@ void Solo5Net::transmit(net::Packet_ptr pckt)
5352 // next in line
5453 auto next = tail->detach_tail ();
5554 // write data to network
56- // explicitly release the data to prevent destructor being called
57- net::Packet* pckt = tail.release ();
58- uint8_t *buf = pckt->buf ();
59-
60- solo5_net_write_sync (buf, pckt->size ());
61-
55+ solo5_net_write_sync (tail->buf (), tail->size ());
56+ // set tail to next, releasing tail
6257 tail = std::move (next);
6358 // Stat increase packets transmitted
6459 packets_tx_++;
@@ -99,8 +94,10 @@ net::Packet_ptr Solo5Net::recv_packet()
9994void Solo5Net::poll ()
10095{
10196 auto pckt_ptr = recv_packet ();
102- if (pckt_ptr != nullptr )
97+
98+ if (LIKELY (pckt_ptr != nullptr )) {
10399 Link::receive (std::move (pckt_ptr));
100+ }
104101}
105102
106103void Solo5Net::deactivate ()
You can’t perform that action at this time.
0 commit comments