Skip to content

Commit a7f6865

Browse files
authored
Merge pull request #12 from Shibin-Ez/master
stage 4 fixes and general typos
2 parents c4c322b + ad02854 commit a7f6865

13 files changed

Lines changed: 21 additions & 21 deletions

File tree

.vitepress/cache/deps/chunk-Z6B2QTD3.js

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/guides/resources/coding-conventions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ If a function is intended to perform a task that could fail, it should return an
7373

7474
### Pointer Return with Error Code
7575

76-
When a function needs to return a pointer to an instance and report an error code, it's not possible in C to return more than one value directly. In such cases, the return type of the function will be a pointer, and a reference to an integer, `int *error`, is passed to the function by the calling function. On error, `NULL` is returned, and the error integer is set to a valid error code.
76+
When a function needs to return a pointer to an instance and report an error code, it is not possible in C to return more than one value directly. In such cases, the return type of the function will be a pointer, and a reference to an integer, `int *error`, is passed to the function by the calling function. On error, `NULL` is returned, and the error integer is set to a valid error code.
7777

7878
For example: `xps_file_t xps_file_create(..., int *error)`. On successful creation of the file instance, a valid pointer will be returned, and `*error` will be set to `E_SUCCESS`. In case of an error, `NULL` is returned, and `*error` is set to a valid error code such as `E_NOTFOUND`.
7979

docs/guides/resources/introduction-to-linux-epoll.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ However, a key drawback of this approach is that each time `select()` or `poll()
88

99
**_epoll_** stands for _event poll_ and is a Linux-specific construct. It allows a process to monitor multiple file descriptors and receive notifications when an event occurs on them. Essentially, it is a kernel data structure facilitating I/O multiplexing on multiple file descriptors.
1010

11-
epoll can be managed through three system calls, facilitating its creation, modification, and deletion. It is notably employed in [Nginx](https://en.wikipedia.org/wiki/Nginx), a popular web server, and it's a fundamental component of our implementation of eXpServer as well.
11+
epoll can be managed through three system calls, facilitating its creation, modification, and deletion. It is notably employed in [Nginx](https://en.wikipedia.org/wiki/Nginx), a popular web server, and it is a fundamental component of our implementation of eXpServer as well.
1212

1313
## **The Problem**
1414

docs/guides/resources/ip.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ IP addresses have two distinct versions or standards:
1717
- The Internet Protocol version 4 ([IPv4](https://en.wikipedia.org/wiki/Internet_Protocol_version_4)) address is the older of the two, which has space for up to 4 billion IP addresses and is assigned to all computers.
1818
- The more recent Internet Protocol version 6 ([IPv6](https://en.wikipedia.org/wiki/IPv6)) has space for trillions of IP addresses
1919

20-
Every device with an internet connection has an IP address, whether it's a computer, laptop, IoT device, or even toys. The IP addresses allow for the efficient transfer of data between two connected devices, allowing machines on different networks to talk to each other.
20+
Every device with an internet connection has an IP address, whether it is a computer, laptop, IoT device, or even toys. The IP addresses allow for the efficient transfer of data between two connected devices, allowing machines on different networks to talk to each other.
2121

2222
Read more about them [here](https://en.wikipedia.org/wiki/IP_address).
2323

docs/guides/resources/linux-epoll.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ This queue holds the list of processes (threads) that are currently blocked in `
1414
#### 2. The Ready List (`rdlist`)
1515
This is a **doubly linked list** that stores the file descriptors (FDs) that are currently "ready" (i.e., have data to read or space to write).
1616
- When an event occurs on a monitored FD, it is added to this list.
17-
- `epoll_wait()` simply checks this list. If it's not empty, it returns the events to the user.
17+
- `epoll_wait()` simply checks this list. If it is not empty, it returns the events to the user.
1818

1919
#### 3. The Red-Black Tree (`rbr`)
2020
This is a **Red-Black Tree** that stores all the file descriptors currently being monitored by this epoll instance.

docs/roadmap/phase-0/stage-1.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ The function takes three arguments:
7272
- **type:** This argument determines the communication semantics and the characteristics of the data transmission over the socket. `SOCK_STREAM` indicates a socket of type stream. Stream sockets provide a reliable, connection-oriented, and sequenced flow of data. They are typically used with the [Transmission Control Protocol (TCP)](https://en.wikipedia.org/wiki/Transmission_Control_Protocol), which ensures that data sent from one end of the connection is received correctly at the other end, with no loss, duplication, or corruption.
7373
- **protocol:** This specifies the specific protocol to be used with the socket. When `0` is passed as the protocol, the system selects the default protocol for the given domain and type combination. For `AF_INET` and `SOCK_STREAM`, this typically results in TCP being chosen as the protocol, as it is the default protocol for stream sockets in the IPv4 domain.
7474

75-
Now that we've initialized our listening socket, it's crucial to ensure its proper functioning, especially in scenarios where the server is stopped and restarted frequently.
75+
Now that we've initialized our listening socket, it is crucial to ensure its proper functioning, especially in scenarios where the server is stopped and restarted frequently.
7676

7777
Assume that our server is up and running, listening on a particular `IP:port` combination. When we terminate the server program, the socket goes into a `TIME_WAIT` state. In the `TIME_WAIT` state, the socket remains open for a predetermined period to ensure that any lingering packets associated with the previous connection are properly handled.
7878

@@ -155,7 +155,7 @@ The [`accept()`](https://en.wikipedia.org/wiki/Berkeley_sockets#:~:text=1%20is%2
155155

156156
- `listen_sock_fd`: The file descriptor of the listening socket.
157157
- `(struct sockaddr *)&client_addr`: A pointer to the `client_addr` structure where information about the client's address will be stored.
158-
- `&client_addr_len`: A pointer to the variable storing the size of the client address structure. Upon successful execution, `accept()` updates this variable with the actual size of the client address structure. This is required because the size of the sockaddr structure may vary depending on whether it's an IPv4 or [IPv6](https://en.wikipedia.org/wiki/IPv6) address.
158+
- `&client_addr_len`: A pointer to the variable storing the size of the client address structure. Upon successful execution, `accept()` updates this variable with the actual size of the client address structure. This is required because the size of the sockaddr structure may vary depending on whether it is an IPv4 or [IPv6](https://en.wikipedia.org/wiki/IPv6) address.
159159

160160
After `accept()` completes successfully, the server can use the `conn_sock_fd` file descriptor to communicate with the client over the newly established connection.
161161

docs/roadmap/phase-0/stage-4.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ In the previous stage we have created a concurrent server using multithreading m
1717

1818
[epoll](https://en.wikipedia.org/wiki/Epoll) is an I/O event notification mechanism provided by the Linux kernel. It allows applications to efficiently monitor multiple file descriptors for various I/O events.
1919

20-
There are various [asynchronous I/O](https://en.wikipedia.org/wiki/Asynchronous_I/O) mechanisms available in operating systems. We have chosen epoll as it is widely used in modern servers such as nginx.
20+
There are various [I/O multiplexing](https://nima101.github.io/io_multiplexing) mechanisms available in operating systems. We have chosen epoll as it is widely used in modern servers such as nginx.
2121

2222
## Implementation
2323

docs/roadmap/phase-0/stage-5-a.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ Now that we have that, we are ready to start accepting connection; so lets write
129129
- Accept the client connection and create the connection socket FD `conn_sock_fd`
130130
- Add the connection socket to epoll to monitor for events using `epoll_ctl()`
131131
- Open up a connection to the upstream server using `connect_upstream()`, and add it to the epoll
132-
- An entry will be added to the route table with the `conn_sock_fd` and it's corresponding `upstream_sock_fd`
132+
- An entry will be added to the route table with the `conn_sock_fd` and it is corresponding `upstream_sock_fd`
133133

134134
```c
135135
void accept_connection(int listen_sock_fd) {

docs/roadmap/phase-0/stage-5-b.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ we opened the file **t2.txt** for writing the contents from the client. Recieve
7777
}
7878
```
7979

80-
The `fprintf()` function in C writes formatted output to a specified file stream. It's defined in the `<stdio.h>` library and works similarly to `printf()`, but instead of writing to the console, it writes to a file. After writing the data into the text file we can close the file using the `fclose()` function.
80+
The `fprintf()` function in C writes formatted output to a specified file stream. It is defined in the `<stdio.h>` library and works similarly to `printf()`, but instead of writing to the console, it writes to a file. After writing the data into the text file we can close the file using the `fclose()` function.
8181

8282
```c
8383
fclose(fp);

docs/roadmap/phase-1/stage-13.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,7 @@ In this function similar to pipes, listeners and connections filter out the numb
481481
482482
## Modifications to `xps_listener` Module
483483
484-
Till the previous stages we have seen that on accepting a connection on the listening socket, the `listener_connection_handler()` will call the `xps_connection_create()` to create a connection instance for the incoming client connection. Further depending on the port on which the client request is received, either upstream module or file module are created using `xps_upstream_create()` or `xps_file_create()` . From this stage on wards instead of directly calling upstream create and file create form `listener_connection_handler()`, we will be calling `xps_session_create()`, which will further decide on whether to create upstream or file modules. On accepting a connection on the listening socket, the `listener_connection_handler()` will create a connection instance as well as a session instance.
484+
Till the previous stages we have seen that on accepting a connection on the listening socket, the `listener_connection_handler()` will call the `xps_connection_create()` to create a connection instance for the incoming client connection. Further depending on the port on which the client request is received, either upstream module or file module are created using `xps_upstream_create()` or `xps_file_create()` . From this stage onwards, instead of directly calling upstream create and file create form `listener_connection_handler()`, we will be calling `xps_session_create()`, which will further decide on whether to create upstream or file modules. On accepting a connection on the listening socket, the `listener_connection_handler()` will create a connection instance as well as a session instance.
485485
486486
```c
487487
void listener_connection_handler(void *ptr) {

0 commit comments

Comments
 (0)