Skip to content

Commit f594192

Browse files
committed
Indent source file properly
1 parent 1cf1e51 commit f594192

File tree

2 files changed

+21
-18
lines changed

2 files changed

+21
-18
lines changed

htstress.c

+5-7
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,8 @@ static const struct option long_options[] = {
111111
{"number", 1, NULL, 'n'}, {"concurrency", 1, NULL, 'c'},
112112
{"threads", 0, NULL, 't'}, {"udaddr", 1, NULL, 'u'},
113113
{"host", 1, NULL, 'h'}, {"debug", 0, NULL, 'd'},
114-
{"help", 0, NULL, '%'}, {NULL, 0, NULL, 0}};
114+
{"help", 0, NULL, '%'}, {NULL, 0, NULL, 0},
115+
};
115116

116117
static void sigint_handler(int arg)
117118
{
@@ -135,8 +136,7 @@ static void end_time()
135136
}
136137
}
137138

138-
/*
139-
* init_conn - initialize new econn or reset closed econn, then put into the
139+
/* init_conn - initialize new econn or reset closed econn, then put into the
140140
* epoll fd.
141141
* @efd: epoll fd
142142
* @ec: empty or closed econn
@@ -158,8 +158,7 @@ static void init_conn(int efd, struct econn *ec)
158158
fcntl(ec->fd, F_SETFL, O_NONBLOCK);
159159

160160
do {
161-
/*
162-
* not accept(server), so it's not conn fd(server side) but client fd.
161+
/* not accept(server), so it's not conn fd(server side) but client fd.
163162
*
164163
* If the connection or binding succeeds, zero is returned. On
165164
* error, -1 is returned, and errno is set to indicate the error.
@@ -186,8 +185,7 @@ static void init_conn(int efd, struct econn *ec)
186185
}
187186
}
188187

189-
/*
190-
* worker - hold epoll logic to handle http request and response.
188+
/* worker - hold epoll logic to handle http request and response.
191189
* @arg: no use
192190
*
193191
* one worker manage concurrency number connections.

http_server.c

+16-11
Original file line numberDiff line numberDiff line change
@@ -42,21 +42,25 @@ struct http_request {
4242
static int http_server_recv(struct socket *sock, char *buf, size_t size)
4343
{
4444
struct kvec iov = {.iov_base = (void *) buf, .iov_len = size};
45-
struct msghdr msg = {.msg_name = 0,
46-
.msg_namelen = 0,
47-
.msg_control = NULL,
48-
.msg_controllen = 0,
49-
.msg_flags = 0};
45+
struct msghdr msg = {
46+
.msg_name = 0,
47+
.msg_namelen = 0,
48+
.msg_control = NULL,
49+
.msg_controllen = 0,
50+
.msg_flags = 0,
51+
};
5052
return kernel_recvmsg(sock, &msg, &iov, 1, size, msg.msg_flags);
5153
}
5254

5355
static int http_server_send(struct socket *sock, const char *buf, size_t size)
5456
{
55-
struct msghdr msg = {.msg_name = NULL,
56-
.msg_namelen = 0,
57-
.msg_control = NULL,
58-
.msg_controllen = 0,
59-
.msg_flags = 0};
57+
struct msghdr msg = {
58+
.msg_name = NULL,
59+
.msg_namelen = 0,
60+
.msg_control = NULL,
61+
.msg_controllen = 0,
62+
.msg_flags = 0,
63+
};
6064
int done = 0;
6165
while (done < size) {
6266
struct kvec iov = {
@@ -152,7 +156,8 @@ static int http_server_worker(void *arg)
152156
.on_header_value = http_parser_callback_header_value,
153157
.on_headers_complete = http_parser_callback_headers_complete,
154158
.on_body = http_parser_callback_body,
155-
.on_message_complete = http_parser_callback_message_complete};
159+
.on_message_complete = http_parser_callback_message_complete,
160+
};
156161
struct http_request request;
157162
struct socket *socket = (struct socket *) arg;
158163

0 commit comments

Comments
 (0)