Skip to content

Commit

Permalink
Fix apparent typos in code in reliable.rst:
Browse files Browse the repository at this point in the history
*  declare `hbuf` in sendSWP as a char array (matching `hbuf` in deliverSWP) instead of untyped array;
*  declare `state` in deliverSWP's parameters as a pointer (matching its usage with -> in deliverSWP);
*  use `hdr.Flags` instead of `hdr->Flags` in deliverSWP (matching `hdr` not being a pointer)
  • Loading branch information
charlesreiss committed Jun 15, 2024
1 parent fc285b5 commit f2b272e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions direct/reliable.rst
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ this count, thus unblocking any waiting sender.
sendSWP(SwpState *state, Msg *frame)
{
struct sendQ_slot *slot;
hbuf[HLEN];
char hbuf[HLEN];
/* wait for send window to open */
semWait(&state->sendWindowNotFull);
Expand Down Expand Up @@ -490,14 +490,14 @@ the prose description given earlier in this section).
.. code-block:: c
static int
deliverSWP(SwpState state, Msg *frame)
deliverSWP(SwpState *state, Msg *frame)
{
SwpHdr hdr;
char *hbuf;
hbuf = msgStripHdr(frame, HLEN);
load_swp_hdr(&hdr, hbuf)
if (hdr->Flags & FLAG_ACK_VALID)
if (hdr.Flags & FLAG_ACK_VALID)
{
/* received an acknowledgment—do SENDER side */
if (swpInWindow(hdr.AckNum, state->LAR + 1, state->LFS))
Expand Down

0 comments on commit f2b272e

Please sign in to comment.