Mark Slee | e854063 | 2006-05-30 09:24:40 +0000 | [diff] [blame] | 1 | #ifndef T_SIMPLE_SERVER_H |
| 2 | #define T_SIMPLE_SERVER_H |
| 3 | |
| 4 | #include "server/TServer.h" |
| 5 | #include "transport/TServerTransport.h" |
| 6 | |
| 7 | /** |
| 8 | * This is the most basic simple server. It is single-threaded and runs a |
| 9 | * continuous loop of accepting a single connection, processing requests on |
| 10 | * that connection until it closes, and then repeating. It is a good example |
| 11 | * of how to extend the TServer interface. |
| 12 | * |
| 13 | * @author Mark Slee <mcslee@facebook.com> |
| 14 | */ |
| 15 | class TSimpleServer : public TServer { |
| 16 | public: |
Mark Slee | 8d7e1f6 | 2006-06-07 06:48:56 +0000 | [diff] [blame] | 17 | TSimpleServer(TProcessor* processor, |
Mark Slee | e854063 | 2006-05-30 09:24:40 +0000 | [diff] [blame] | 18 | TServerOptions* options, |
| 19 | TServerTransport* serverTransport) : |
Mark Slee | 8d7e1f6 | 2006-06-07 06:48:56 +0000 | [diff] [blame] | 20 | TServer(processor, options), serverTransport_(serverTransport) {} |
Mark Slee | e854063 | 2006-05-30 09:24:40 +0000 | [diff] [blame] | 21 | |
| 22 | ~TSimpleServer() {} |
| 23 | |
| 24 | void run(); |
| 25 | |
| 26 | protected: |
| 27 | TServerTransport* serverTransport_; |
| 28 | }; |
| 29 | |
| 30 | #endif |