mirror of
https://gitee.com/acl-dev/acl.git
synced 2024-11-30 10:57:34 +08:00
add send method in tcp_pool class.
This commit is contained in:
parent
2e7167bfd7
commit
ffcfd87d26
@ -5,6 +5,7 @@
|
||||
namespace acl
|
||||
{
|
||||
|
||||
class string;
|
||||
class connect_client;
|
||||
|
||||
class ACL_CPP_API tcp_pool : public connect_pool
|
||||
@ -13,6 +14,8 @@ public:
|
||||
tcp_pool(const char* addr, size_t count, size_t idx = 0);
|
||||
virtual ~tcp_pool(void);
|
||||
|
||||
bool send(const void* data, unsigned int len, string* out = NULL);
|
||||
|
||||
protected:
|
||||
// @override
|
||||
virtual connect_client* create_connect(void);
|
||||
|
@ -18,7 +18,7 @@ namespace acl
|
||||
class socket_stream;
|
||||
class string;
|
||||
|
||||
class tcp_reader
|
||||
class ACL_CPP_API tcp_reader
|
||||
{
|
||||
public:
|
||||
tcp_reader(socket_stream& conn);
|
||||
|
@ -22,4 +22,25 @@ connect_client* tcp_pool::create_connect(void)
|
||||
return conn;
|
||||
}
|
||||
|
||||
bool tcp_pool::send(const void* data, unsigned int len,
|
||||
string* out /* = NULL */)
|
||||
{
|
||||
tcp_client* conn = (tcp_client*) this->peek();
|
||||
if (conn == NULL)
|
||||
{
|
||||
logger_error("no connection available, addr=%s",
|
||||
this->get_addr());
|
||||
return false;
|
||||
}
|
||||
|
||||
if (conn->send(data, len, out) == false)
|
||||
{
|
||||
this->put(conn, false);
|
||||
return false;
|
||||
}
|
||||
|
||||
this->put(conn);
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace acl
|
||||
|
@ -212,7 +212,7 @@ static void polarssl_dll_load(void)
|
||||
# define __pkey_free ::rsa_free
|
||||
# endif
|
||||
|
||||
# define __entropy_init ::entropy_init
|
||||
# define __entropy_init ::entropy_init
|
||||
# define __ssl_list_ciphersuites ::ssl_list_ciphersuites
|
||||
# define __ssl_set_ciphersuites ::ssl_set_ciphersuites
|
||||
# define __ssl_set_session_cache ::ssl_set_session_cache
|
||||
|
Loading…
Reference in New Issue
Block a user