acl/app/master/daemon/manage/manager.cpp

46 lines
714 B
C++
Raw Normal View History

2017-06-14 17:42:05 +08:00
/**
* Copyright (C) 2015-2018
* All rights reserved.
*
* AUTHOR(S)
* Zheng Shuxin
* E-mail: zhengshuxin@qiyi.com
*
* VERSION
* Wed 14 Jun 2017 05:30:59 PM CST
*/
#include "stdafx.h"
#include "manager.h"
manager::manager(void)
2017-09-24 21:10:28 +08:00
: event_(NULL)
, aio_(NULL)
, handle_(NULL)
, server_(NULL)
2017-06-14 17:42:05 +08:00
{
}
2017-06-15 11:28:01 +08:00
manager::~manager(void)
2017-06-14 17:42:05 +08:00
{
2017-06-15 11:28:01 +08:00
delete server_;
delete handle_;
if (aio_)
acl_aio_free2(aio_, 1);
2017-06-14 17:42:05 +08:00
}
2017-06-26 13:19:43 +08:00
void manager::init(ACL_EVENT* event, const char* addr, int rw_timeout)
2017-06-14 17:42:05 +08:00
{
2017-06-15 11:28:01 +08:00
acl_assert(event);
if (addr == NULL || *addr == 0)
return;
event_ = event;
aio_ = acl_aio_create3(event);
handle_ = new acl::aio_handle(aio_);
2017-06-26 13:19:43 +08:00
server_ = new http_server(*handle_, rw_timeout);
2017-06-15 11:28:01 +08:00
server_->open(addr);
2017-06-14 17:42:05 +08:00
}