| 233 | } |
| 234 | |
| 235 | aio_socket_stream* aio_socket_stream::bind(aio_handle* handle, const char * addr) |
| 236 | { |
| 237 | acl_assert(handle); |
| 238 | unsigned flag = ACL_INET_FLAG_NBLOCK | ACL_INET_FLAG_REUSEPORT; |
| 239 | |
| 240 | ACL_VSTREAM* vstream = acl_vstream_bind(addr, 0, flag); |
| 241 | if (vstream == NULL) { |
| 242 | logger_error("bind %s error %s", addr, last_serror()); |
| 243 | return NULL; |
| 244 | } |
| 245 | |
| 246 | ACL_AIO* aio = handle->get_handle(); |
| 247 | ACL_ASTREAM* astream = acl_aio_open(aio, vstream); |
| 248 | aio_socket_stream* stream = NEW aio_socket_stream(handle, astream, true); |
| 249 | return stream; |
| 250 | } |
| 251 | |
| 252 | bool aio_socket_stream::is_opened() const |
| 253 | { |
nothing calls this directly
no test coverage detected