|
|
@ -25,6 +25,7 @@
|
|
|
|
#include <event2/keyvalq_struct.h>
|
|
|
|
#include <event2/keyvalq_struct.h>
|
|
|
|
#include <event2/listener.h>
|
|
|
|
#include <event2/listener.h>
|
|
|
|
#include <event2/util.h>
|
|
|
|
#include <event2/util.h>
|
|
|
|
|
|
|
|
#include <event2/thread.h>
|
|
|
|
|
|
|
|
|
|
|
|
#include <cstdio>
|
|
|
|
#include <cstdio>
|
|
|
|
#include <cstdlib>
|
|
|
|
#include <cstdlib>
|
|
|
@ -32,6 +33,7 @@
|
|
|
|
#include <functional>
|
|
|
|
#include <functional>
|
|
|
|
#include <memory>
|
|
|
|
#include <memory>
|
|
|
|
#include <string>
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
#include <atomic>
|
|
|
|
|
|
|
|
|
|
|
|
namespace mindspore {
|
|
|
|
namespace mindspore {
|
|
|
|
namespace ps {
|
|
|
|
namespace ps {
|
|
|
@ -55,7 +57,12 @@ class HttpServer {
|
|
|
|
public:
|
|
|
|
public:
|
|
|
|
// Server address only support IPV4 now, and should be in format of "x.x.x.x"
|
|
|
|
// Server address only support IPV4 now, and should be in format of "x.x.x.x"
|
|
|
|
explicit HttpServer(const std::string &address, std::uint16_t port)
|
|
|
|
explicit HttpServer(const std::string &address, std::uint16_t port)
|
|
|
|
: server_address_(address), server_port_(port), event_base_(nullptr), event_http_(nullptr), is_init_(false) {}
|
|
|
|
: server_address_(address),
|
|
|
|
|
|
|
|
server_port_(port),
|
|
|
|
|
|
|
|
event_base_(nullptr),
|
|
|
|
|
|
|
|
event_http_(nullptr),
|
|
|
|
|
|
|
|
is_init_(false),
|
|
|
|
|
|
|
|
is_stop_(true) {}
|
|
|
|
|
|
|
|
|
|
|
|
~HttpServer();
|
|
|
|
~HttpServer();
|
|
|
|
|
|
|
|
|
|
|
@ -84,6 +91,7 @@ class HttpServer {
|
|
|
|
struct event_base *event_base_;
|
|
|
|
struct event_base *event_base_;
|
|
|
|
struct evhttp *event_http_;
|
|
|
|
struct evhttp *event_http_;
|
|
|
|
bool is_init_;
|
|
|
|
bool is_init_;
|
|
|
|
|
|
|
|
std::atomic<bool> is_stop_;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
} // namespace core
|
|
|
|
} // namespace core
|
|
|
|