aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRafael G. Martins <rafael@rafaelmartins.eng.br>2017-03-05 01:54:54 +0100
committerRafael G. Martins <rafael@rafaelmartins.eng.br>2017-03-05 01:54:54 +0100
commite80177752184bab0ec4290d1b04da9019690273f (patch)
tree6a7676252e7de0bae6cb32c93d4730a0b4b827fb /src
parent1390e77b0742a9fd38ca9986f76f04a7ffab16a4 (diff)
downloadblogc-e80177752184bab0ec4290d1b04da9019690273f.tar.gz
blogc-e80177752184bab0ec4290d1b04da9019690273f.tar.bz2
blogc-e80177752184bab0ec4290d1b04da9019690273f.zip
runserver: move var declarations to loop
Diffstat (limited to 'src')
-rw-r--r--src/blogc-runserver/httpd.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/blogc-runserver/httpd.c b/src/blogc-runserver/httpd.c
index e4eb986..847f8f9 100644
--- a/src/blogc-runserver/httpd.c
+++ b/src/blogc-runserver/httpd.c
@@ -318,22 +318,22 @@ br_httpd_run(const char *host, const char *port, const char *docroot,
size_t current_thread = 0;
- struct sockaddr_in6 addr6;
- struct sockaddr_in addr;
+ while (1) {
+ struct sockaddr_in6 addr6;
+ struct sockaddr_in addr;
- socklen_t addrlen;
- struct sockaddr *client_addr = NULL;
+ socklen_t addrlen;
+ struct sockaddr *client_addr = NULL;
- if (f->ai_family == AF_INET6) {
- addrlen = sizeof(addr6);
- client_addr = (struct sockaddr*) &addr6;
- }
- else {
- addrlen = sizeof(addr);
- client_addr = (struct sockaddr*) &addr;
- }
+ if (f->ai_family == AF_INET6) {
+ addrlen = sizeof(addr6);
+ client_addr = (struct sockaddr*) &addr6;
+ }
+ else {
+ addrlen = sizeof(addr);
+ client_addr = (struct sockaddr*) &addr;
+ }
- while (1) {
int client_socket = accept(server_socket, client_addr, &addrlen);
if (client_socket == -1) {
fprintf(stderr, "Failed to accept connection: %s\n", strerror(errno));