server 0.0.1
basicserverinfrastructure

src/server/read.c

Go to the documentation of this file.
00001 static
00002 int
00003 serverRead(Server this, unsigned int i)
00004 {
00005         int fd = (this->fds)[i].fd;
00006 
00007         if (NULL == (this->conns)[fd].reader) {
00008                 loggerLog(
00009                                 this->logger,
00010                                 LOGGER_INFO,
00011                                 "initialization error: NULL reader");
00012                 serverCloseConn(this, i);
00013         }
00014 
00015         switch (streamReaderRead((this->conns)[fd].reader, fd)) {
00016                 case 0:
00017                         /*
00018                          * normal close: write remaining data
00019                          * @TODO: actually we have no remaining data here....
00020                          */
00021                         /* DROP-THROUGH */
00022 
00023                 case -1: 
00024                         /*
00025                          * read failure / close connection
00026                          */
00027                         loggerLog(this->logger, LOGGER_INFO, "connection closed...");
00028                         serverCloseConn(this, i);
00029                         break;
00030 
00031                 default:
00032                         break;
00033         }
00034 
00035         return 0;
00036 }
00037 
00038 // vim: set ts=4 sw=4:
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines