Lines Matching refs:asio
58 AsyncSocketIO* asio);
134 AsyncSocketIO* asio = _asio_recycled; in _async_socket_rw_new() local
135 if (asio != NULL) { in _async_socket_rw_new()
137 _asio_recycled = asio->next; in _async_socket_rw_new()
141 ANEW0(asio); in _async_socket_rw_new()
144 asio->next = NULL; in _async_socket_rw_new()
145 asio->as = as; in _async_socket_rw_new()
146 asio->is_io_read = is_io_read; in _async_socket_rw_new()
147 asio->buffer = (uint8_t*)buffer; in _async_socket_rw_new()
148 asio->to_transfer = len; in _async_socket_rw_new()
149 asio->transferred = 0; in _async_socket_rw_new()
150 asio->on_io = io_cb; in _async_socket_rw_new()
151 asio->io_opaque = io_opaque; in _async_socket_rw_new()
152 asio->state = ASIO_STATE_QUEUED; in _async_socket_rw_new()
153 asio->ref_count = 1; in _async_socket_rw_new()
154 asio->deadline = deadline; in _async_socket_rw_new()
155 loopTimer_init(asio->timer, _async_socket_get_looper(as), in _async_socket_rw_new()
156 _on_async_socket_io_timed_out, asio); in _async_socket_rw_new()
157 loopTimer_startAbsolute(asio->timer, deadline); in _async_socket_rw_new()
163 _async_socket_string(as), is_io_read ? "READ" : "WRITE", asio, len); in _async_socket_rw_new()
165 return asio; in _async_socket_rw_new()
170 _async_socket_io_free(AsyncSocketIO* asio) in _async_socket_io_free() argument
172 AsyncSocket* const as = asio->as; in _async_socket_io_free()
175 _async_socket_string(as), asio->is_io_read ? "READ" : "WRITE", asio); in _async_socket_io_free()
177 loopTimer_done(asio->timer); in _async_socket_io_free()
181 asio->next = _asio_recycled; in _async_socket_io_free()
182 _asio_recycled = asio; in _async_socket_io_free()
185 AFREE(asio); in _async_socket_io_free()
194 _async_socket_io_finished(AsyncSocketIO* asio) in _async_socket_io_finished() argument
197 asio->on_io(asio->io_opaque, asio, ASIO_STATE_FINISHED); in _async_socket_io_finished()
201 async_socket_io_reference(AsyncSocketIO* asio) in async_socket_io_reference() argument
203 assert(asio->ref_count > 0); in async_socket_io_reference()
204 asio->ref_count++; in async_socket_io_reference()
205 return asio->ref_count; in async_socket_io_reference()
209 async_socket_io_release(AsyncSocketIO* asio) in async_socket_io_release() argument
211 assert(asio->ref_count > 0); in async_socket_io_release()
212 asio->ref_count--; in async_socket_io_release()
213 if (asio->ref_count == 0) { in async_socket_io_release()
214 _async_socket_io_finished(asio); in async_socket_io_release()
216 _async_socket_io_free(asio); in async_socket_io_release()
219 return asio->ref_count; in async_socket_io_release()
240 AsyncSocketIO* const asio = _async_socket_rw_new(as, 1, buffer, len, io_cb, in _async_socket_reader_new() local
242 return asio; in _async_socket_reader_new()
263 AsyncSocketIO* const asio = _async_socket_rw_new(as, 0, (void*)buffer, len, in _async_socket_writer_new() local
266 return asio; in _async_socket_writer_new()
273 AsyncSocketIO* const asio = (AsyncSocketIO*)opaque; in _on_async_socket_io_timed_out() local
274 AsyncSocket* const as = asio->as; in _on_async_socket_io_timed_out()
277 _async_socket_string(as), asio->is_io_read ? "READ" : "WRITE", in _on_async_socket_io_timed_out()
278 asio->deadline, async_socket_deadline(as, 0)); in _on_async_socket_io_timed_out()
281 async_socket_io_reference(asio); in _on_async_socket_io_timed_out()
282 _async_socket_io_timed_out(asio->as, asio); in _on_async_socket_io_timed_out()
283 async_socket_io_release(asio); in _on_async_socket_io_timed_out()
291 async_socket_io_get_socket(const AsyncSocketIO* asio) in async_socket_io_get_socket() argument
293 async_socket_reference(asio->as); in async_socket_io_get_socket()
294 return asio->as; in async_socket_io_get_socket()
298 async_socket_io_cancel_time_out(AsyncSocketIO* asio) in async_socket_io_cancel_time_out() argument
300 loopTimer_stop(asio->timer); in async_socket_io_cancel_time_out()
304 async_socket_io_get_io_opaque(const AsyncSocketIO* asio) in async_socket_io_get_io_opaque() argument
306 return asio->io_opaque; in async_socket_io_get_io_opaque()
310 async_socket_io_get_client_opaque(const AsyncSocketIO* asio) in async_socket_io_get_client_opaque() argument
312 return async_socket_get_client_opaque(asio->as); in async_socket_io_get_client_opaque()
316 async_socket_io_get_buffer_info(const AsyncSocketIO* asio, in async_socket_io_get_buffer_info() argument
321 *transferred = asio->transferred; in async_socket_io_get_buffer_info()
324 *to_transfer = asio->to_transfer; in async_socket_io_get_buffer_info()
326 return asio->buffer; in async_socket_io_get_buffer_info()
330 async_socket_io_get_buffer(const AsyncSocketIO* asio) in async_socket_io_get_buffer() argument
332 return asio->buffer; in async_socket_io_get_buffer()
336 async_socket_io_get_transferred(const AsyncSocketIO* asio) in async_socket_io_get_transferred() argument
338 return asio->transferred; in async_socket_io_get_transferred()
342 async_socket_io_get_to_transfer(const AsyncSocketIO* asio) in async_socket_io_get_to_transfer() argument
344 return asio->to_transfer; in async_socket_io_get_to_transfer()
348 async_socket_io_is_read(const AsyncSocketIO* asio) in async_socket_io_is_read() argument
350 return asio->is_io_read; in async_socket_io_is_read()
546 _async_socket_complete_io(AsyncSocket* as, AsyncSocketIO* asio) in _async_socket_complete_io() argument
549 _async_socket_string(as), asio->is_io_read ? "READ" : "WRITE", asio); in _async_socket_complete_io()
552 async_socket_io_cancel_time_out(asio); in _async_socket_complete_io()
554 return asio->on_io(asio->io_opaque, asio, ASIO_STATE_SUCCEEDED); in _async_socket_complete_io()
565 _async_socket_io_timed_out(AsyncSocket* as, AsyncSocketIO* asio) in _async_socket_io_timed_out() argument
568 _async_socket_string(as), asio->is_io_read ? "READ" : "WRITE", asio, in _async_socket_io_timed_out()
569 asio->deadline, async_socket_deadline(as, 0)); in _async_socket_io_timed_out()
572 const AsyncIOAction action = asio->on_io(asio->io_opaque, asio, in _async_socket_io_timed_out()
577 if (asio->is_io_read) { in _async_socket_io_timed_out()
578 _async_socket_remove_io(as, &as->readers_head, &as->readers_tail, asio); in _async_socket_io_timed_out()
580 _async_socket_remove_io(as, &as->writers_head, &as->writers_tail, asio); in _async_socket_io_timed_out()
595 _async_socket_cancel_io(AsyncSocket* as, AsyncSocketIO* asio) in _async_socket_cancel_io() argument
598 _async_socket_string(as), asio->is_io_read ? "READ" : "WRITE", asio); in _async_socket_cancel_io()
601 async_socket_io_cancel_time_out(asio); in _async_socket_cancel_io()
603 return asio->on_io(asio->io_opaque, asio, ASIO_STATE_CANCELLED); in _async_socket_cancel_io()
615 _async_socket_io_failure(AsyncSocket* as, AsyncSocketIO* asio, int failure) in _async_socket_io_failure() argument
618 _async_socket_string(as), asio->is_io_read ? "READ" : "WRITE", asio, in _async_socket_io_failure()
622 async_socket_io_cancel_time_out(asio); in _async_socket_io_failure()
625 return asio->on_io(asio->io_opaque, asio, ASIO_STATE_FAILED); in _async_socket_io_failure()
774 _on_async_socket_failure(AsyncSocket* as, AsyncSocketIO* asio) in _on_async_socket_failure() argument
777 _async_socket_string(as), asio->is_io_read ? "READ" : "WRITE", in _on_async_socket_failure()
781 return _async_socket_io_failure(as, asio, errno); in _on_async_socket_failure()