forked from curl/everything-curl
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
statemachines.md: add the state image
With an associated explanation of the shown states
- Loading branch information
Showing
2 changed files
with
26 additions
and
5 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,38 @@ | ||
# Everything is state machines | ||
|
||
To facilitate that non-blocking nature, the curl source is full of state | ||
machines. Work on as much data as there is and drive the state machine to | ||
where it can go based on what's available and allow the functions to continue | ||
from that point later on when more data arrives that then might drive the | ||
state machine further. | ||
To facilitate non-blocking behavior all through, the curl source is full of | ||
state machines. Work on as much data as there is and drive the state machine | ||
to where it can go based on what's available and allow the functions to | ||
continue from that point later on when more data arrives that then might drive | ||
the state machine further. | ||
|
||
There are such states in many different levels for a given transfer and the | ||
code for each particular protocol may have its own set of state machines. | ||
|
||
## mstate | ||
|
||
One of the primary states is the main transfer "mode" the easy handle holds, | ||
which says if the current transfer is resolving, waiting for a resolve, | ||
connecting, waiting for a connect, issuing a request, doing a transfer etc | ||
(see the `CURLMstate` enum in `lib/multihandle.h`). Every transfer done with | ||
libcurl has an associated easy handle and every easy handle will exercise that | ||
state machine. | ||
|
||
The image below shows all states and possible state transitions. See further | ||
explanation below. | ||
|
||
![libcurl transfer state machine](slide-transfer-state-machine.jpg) | ||
|
||
All transfers start in **INIT** and they end in **MSGSENT** | ||
|
||
**yellow**: the initial setting-up states | ||
|
||
**blue**: resolving names and setting up the connection | ||
|
||
**green**: initiating and setting up the transfer | ||
|
||
**white**: the transfer | ||
|
||
**red**: post-transfer | ||
|
||
All states within the striped area have an associated connection. |