File src/net/tcp.cpp changed (mode: 100644) (index f301031..274540f) |
... |
... |
void |
25 |
25 |
TCPSocket::send(span<const std::uint8_t> buf) |
TCPSocket::send(span<const std::uint8_t> buf) |
26 |
26 |
{ |
{ |
27 |
27 |
auto state = const_cast<volatile TCPSocketState *>(&this->state); |
auto state = const_cast<volatile TCPSocketState *>(&this->state); |
|
28 |
|
// Wait. (XXX: Potentially forever...) |
28 |
29 |
while (*state != TCPSocketState::Established) { |
while (*state != TCPSocketState::Established) { |
29 |
|
// Wait. (XXX: Potentially forever...) |
|
|
30 |
|
// XXX: we are probably reading memory of a dead object here... |
|
31 |
|
if (*state == TCPSocketState::Closed) { |
|
32 |
|
return; |
|
33 |
|
} |
30 |
34 |
} |
} |
31 |
35 |
backend.send(*this, buf, TCPFlags::ACK); |
backend.send(*this, buf, TCPFlags::ACK); |
32 |
36 |
} |
} |