| 22 | } |
| 23 | |
| 24 | bool tcp_pool::send(const void* data, unsigned int len, string* out /* = NULL */) |
| 25 | { |
| 26 | tcp_client* conn = (tcp_client*) this->peek(); |
| 27 | if (conn == NULL) { |
| 28 | logger_error("no connection available, addr=%s", |
| 29 | this->get_addr()); |
| 30 | return false; |
| 31 | } |
| 32 | |
| 33 | if (!conn->send(data, len, out)) { |
| 34 | this->put(conn, false); |
| 35 | return false; |
| 36 | } |
| 37 | |
| 38 | this->put(conn); |
| 39 | return true; |
| 40 | } |
| 41 | |
| 42 | } // namespace acl |