Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdlib.h>
- #include "states.h"
- int random(int from, int to) {
- return rand() % (to - from) + from;
- }
- int open_connection_state(void) {
- int action = random(0, 10);
- if (action % 2 == 0) return done;
- else return error;
- }
- int wait_for_request_state(void) {
- int action = random(0, 100);
- if (action % 10 == 0) return request_available;
- else return no_request;
- }
- int get_request_state(void) {
- int action = random(0, 100);
- if (action % 3 == 0) return done;
- else return error;
- }
- int find_handler_state(void) {
- int action = random(0, 100);
- if (action % 5 == 0) return handler_available;
- else return error;
- }
- int send_response_state(void) {
- return done;
- }
- int send_error_state(void) {
- return done;
- }
- int close_connection_state(void) {
- return done;
- }
Advertisement
Add Comment
Please, Sign In to add comment