HttpServer.h 489 B

1234567891011121314151617181920212223242526272829
  1. #ifndef HTTP_SERVER_H_
  2. #define HTTP_SERVER_H_
  3. #include "HttpService.h"
  4. class HttpServer {
  5. public:
  6. HttpServer();
  7. int SetListenPort(int port);
  8. void SetWorkerProcesses(int worker_processes) {
  9. this->worker_processes = worker_processes;
  10. }
  11. void RegisterService(HttpService* service) {
  12. this->service = service;
  13. }
  14. void Run(bool wait = true);
  15. public:
  16. int port;
  17. int worker_processes;
  18. HttpService* service;
  19. int listenfd_;
  20. };
  21. #endif