Commit 5c1c6a80cf88cc6ecc244669e87eb21ad274a1e8

Authored by Georg Hopp
1 parent 6550e381

some more cleanups in the server code. Removing not needed header includes

  1 +2012-02-15 12:30:33 +0100 Georg Hopp
  2 +
  3 + * some more cleanups in the server code. Removing not needed header includes (HEAD, master)
  4 +
  5 +2012-02-15 12:17:39 +0100 Georg Hopp
  6 +
  7 + * Merge branch 'master' of 192.168.100.2:/var/lib/git/server (origin/master, origin/HEAD)
  8 +
1 2012-02-15 12:17:00 +0100 Georg Hopp 9 2012-02-15 12:17:00 +0100 Georg Hopp
2 10
3 - * now the separated http worker works. Changed some size_t to ssize_t as i use -1 and -2 es error indicator in my server and fixed caculation of remainig buffer size in reader (HEAD, master) 11 + * now the separated http worker works. Changed some size_t to ssize_t as i use -1 and -2 es error indicator in my server and fixed caculation of remainig buffer size in reader
4 12
5 2012-02-15 09:38:32 +0100 Georg Hopp 13 2012-02-15 09:38:32 +0100 Georg Hopp
6 14
@@ -10,6 +18,10 @@ @@ -10,6 +18,10 @@
10 18
11 * add subject/observer interface 19 * add subject/observer interface
12 20
  21 +2012-02-15 06:19:52 +0100 Georg Hopp
  22 +
  23 + * add subject/observer interface
  24 +
13 2012-02-15 04:55:46 +0100 Georg Hopp 25 2012-02-15 04:55:46 +0100 Georg Hopp
14 26
15 * fix infinite busy loop in run 27 * fix infinite busy loop in run
  1 +#include <errno.h>
  2 +
1 static 3 static
2 int 4 int
3 serverHandleAccept(Server this) 5 serverHandleAccept(Server this)
@@ -19,6 +21,20 @@ serverHandleAccept(Server this) @@ -19,6 +21,20 @@ serverHandleAccept(Server this)
19 this->nfds++; 21 this->nfds++;
20 } else { 22 } else {
21 delete(&acc); 23 delete(&acc);
  24 +
  25 + switch(errno) {
  26 + case EAGAIN:
  27 + loggerLog(this->logger,
  28 + LOGGER_DEBUG,
  29 + "server accept blocks");
  30 + break;
  31 +
  32 + default:
  33 + loggerLog(this->logger,
  34 + LOGGER_DEBUG,
  35 + "server accept error");
  36 + break;
  37 + }
22 } 38 }
23 39
24 return (acc)? acc->handle : -1; 40 return (acc)? acc->handle : -1;
  1 +#include <poll.h>
  2 +#include <errno.h>
  3 +
1 #define POLLFD(ptr) ((struct pollfd *)(ptr)) 4 #define POLLFD(ptr) ((struct pollfd *)(ptr))
2 #define SWAP(a, b) ((a)^=(b),(b)^=(a),(a)^=(b)) 5 #define SWAP(a, b) ((a)^=(b),(b)^=(a),(a)^=(b))
3 6
1 -#include <poll.h> /* for poll system call and related */  
2 -#include <string.h> /* for memset and stuff */  
3 -#include <stdlib.h> /* for exit */  
4 -#include <errno.h> /* for errno */  
5 -#include <unistd.h>  
6 -#include <ctype.h>  
7 -#include <time.h>  
8 -#include <errno.h>  
9 -#include <fcntl.h>  
10 -#include <sys/types.h>  
11 -#include <sys/stat.h>  
12 -  
13 #include "server.h" 1 #include "server.h"
14 #include "socket.h" 2 #include "socket.h"
15 #include "logger.h" 3 #include "logger.h"
@@ -64,20 +52,6 @@ serverRun(Server this) @@ -64,20 +52,6 @@ serverRun(Server this)
64 if (this->sock->handle == (this->fds)[i].fd) { 52 if (this->sock->handle == (this->fds)[i].fd) {
65 while(-1 != serverHandleAccept(this) && 0 < naccs) { 53 while(-1 != serverHandleAccept(this) && 0 < naccs) {
66 naccs--; 54 naccs--;
67 -  
68 - switch(errno) {  
69 - case EAGAIN:  
70 - loggerLog(this->logger,  
71 - LOGGER_DEBUG,  
72 - "server accept blocks");  
73 - break;  
74 -  
75 - default:  
76 - loggerLog(this->logger,  
77 - LOGGER_DEBUG,  
78 - "server accept error");  
79 - break;  
80 - }  
81 } 55 }
82 } 56 }
83 57
Please register or login to post a comment