read.c
737 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
static
int
serverRead(Server this, unsigned int i)
{
int fd = (this->fds)[i].fd;
int size;
if (NULL == (this->conns)[fd].reader) {
loggerLog(
this->logger,
LOGGER_INFO,
"initialization error: NULL reader");
return -1;
}
switch ((size = streamReaderRead((this->conns)[fd].reader, fd))) {
case 0:
/*
* normal close: write remaining data
* @TODO: actually we have no remaining data here....
*/
/* DROP-THROUGH */
case -1:
/*
* read failure / close connection
*/
loggerLog(this->logger, LOGGER_INFO,
"connection[%d] closed...%s",
fd,
inet_ntoa((((this->conns)[fd].sock)->addr).sin_addr));
break;
default:
break;
}
return size;
}
// vim: set ts=4 sw=4: