Mark Slee | f5f2be4 | 2006-09-05 21:05:31 +0000 | [diff] [blame] | 1 | #ifndef _THRIFT_TRANSPORT_TSERVERSOCKET_H_ |
| 2 | #define _THRIFT_TRANSPORT_TSERVERSOCKET_H_ 1 |
Mark Slee | e854063 | 2006-05-30 09:24:40 +0000 | [diff] [blame] | 3 | |
Marc Slemko | d42a2c2 | 2006-08-10 03:30:18 +0000 | [diff] [blame] | 4 | #include "TServerTransport.h" |
Marc Slemko | 1669885 | 2006-08-04 03:16:10 +0000 | [diff] [blame] | 5 | #include <boost/shared_ptr.hpp> |
Mark Slee | e854063 | 2006-05-30 09:24:40 +0000 | [diff] [blame] | 6 | |
Marc Slemko | 6f038a7 | 2006-08-03 18:58:09 +0000 | [diff] [blame] | 7 | namespace facebook { namespace thrift { namespace transport { |
| 8 | |
Mark Slee | e854063 | 2006-05-30 09:24:40 +0000 | [diff] [blame] | 9 | class TSocket; |
| 10 | |
| 11 | /** |
| 12 | * Server socket implementation of TServerTransport. Wrapper around a unix |
| 13 | * socket listen and accept calls. |
| 14 | * |
| 15 | * @author Mark Slee <mcslee@facebook.com> |
| 16 | */ |
| 17 | class TServerSocket : public TServerTransport { |
| 18 | public: |
| 19 | TServerSocket(int port); |
Mark Slee | 2905078 | 2006-09-29 00:12:30 +0000 | [diff] [blame^] | 20 | TServerSocket(int port, int sendTimeout, int recvTimeout); |
| 21 | |
Mark Slee | e854063 | 2006-05-30 09:24:40 +0000 | [diff] [blame] | 22 | ~TServerSocket(); |
| 23 | |
Mark Slee | 2905078 | 2006-09-29 00:12:30 +0000 | [diff] [blame^] | 24 | void setSendTimeout(int sendTimeout); |
| 25 | void setRecvTimeout(int recvTimeout); |
| 26 | |
Mark Slee | 8d7e1f6 | 2006-06-07 06:48:56 +0000 | [diff] [blame] | 27 | void listen(); |
Mark Slee | e854063 | 2006-05-30 09:24:40 +0000 | [diff] [blame] | 28 | void close(); |
| 29 | |
Mark Slee | 8d7e1f6 | 2006-06-07 06:48:56 +0000 | [diff] [blame] | 30 | protected: |
Marc Slemko | 1669885 | 2006-08-04 03:16:10 +0000 | [diff] [blame] | 31 | shared_ptr<TTransport> acceptImpl(); |
Mark Slee | 8d7e1f6 | 2006-06-07 06:48:56 +0000 | [diff] [blame] | 32 | |
Mark Slee | e854063 | 2006-05-30 09:24:40 +0000 | [diff] [blame] | 33 | private: |
Mark Slee | e854063 | 2006-05-30 09:24:40 +0000 | [diff] [blame] | 34 | int port_; |
| 35 | int serverSocket_; |
| 36 | int acceptBacklog_; |
Mark Slee | 2905078 | 2006-09-29 00:12:30 +0000 | [diff] [blame^] | 37 | int sendTimeout_; |
| 38 | int recvTimeout_; |
Mark Slee | e854063 | 2006-05-30 09:24:40 +0000 | [diff] [blame] | 39 | }; |
| 40 | |
Marc Slemko | 6f038a7 | 2006-08-03 18:58:09 +0000 | [diff] [blame] | 41 | }}} // facebook::thrift::transport |
| 42 | |
Mark Slee | f5f2be4 | 2006-09-05 21:05:31 +0000 | [diff] [blame] | 43 | #endif // #ifndef _THRIFT_TRANSPORT_TSERVERSOCKET_H_ |