xaizek / tos (License: GPLv3 only) (since 2018-12-07)
This is an alternative version of sources presented as part of Write Your Own OS video tutorial by Viktor Engelmann.
Commit 9c0cf63fb1e8371c0afe58ea9152684cfd89ac3e

Leave TCPSocket::send on socket close
Socket was freed by then...
Author: xaizek
Author date (UTC): 2018-04-12 14:28
Committer name: xaizek
Committer date (UTC): 2018-04-12 14:28
Parent(s): 4002e5a3439869cf5d4bce93a2feea8008c4be05
Signing key: 99DC5E4DB05F6BE2
Tree: e0ed049fba2081897792a5d2fba8de1f4f579e4b
File Lines added Lines deleted
src/net/tcp.cpp 5 1
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 } }
Hints

Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://code.reversed.top/user/xaizek/tos

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@code.reversed.top/user/xaizek/tos

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a pull request:
... clone the repository ...
... make some changes and some commits ...
git push origin master