mirror of https://github.com/yandex/odyssey.git
machinarium: support tls use with connected io
This commit is contained in:
parent
1cea9190d8
commit
fae1d60ae1
|
@ -121,9 +121,6 @@ machine_error(machine_io_t);
|
|||
MACHINE_API int
|
||||
machine_fd(machine_io_t);
|
||||
|
||||
MACHINE_API void
|
||||
machine_set_tls(machine_io_t, machine_tls_t);
|
||||
|
||||
MACHINE_API int
|
||||
machine_set_nodelay(machine_io_t, int enable);
|
||||
|
||||
|
@ -133,6 +130,9 @@ machine_set_keepalive(machine_io_t, int enable, int delay);
|
|||
MACHINE_API int
|
||||
machine_set_readahead(machine_io_t, int size);
|
||||
|
||||
MACHINE_API int
|
||||
machine_set_tls(machine_io_t, machine_tls_t);
|
||||
|
||||
/* dns */
|
||||
|
||||
MACHINE_API int
|
||||
|
|
|
@ -128,13 +128,6 @@ machine_close(machine_io_t obj)
|
|||
mm_io_close_handle(io, (uv_handle_t*)&io->handle);
|
||||
}
|
||||
|
||||
MACHINE_API void
|
||||
machine_set_tls(machine_io_t obj, machine_tls_t tls_obj)
|
||||
{
|
||||
mm_io_t *io = obj;
|
||||
io->tls_obj = tls_obj;
|
||||
}
|
||||
|
||||
MACHINE_API int
|
||||
machine_errno(machine_io_t obj)
|
||||
{
|
||||
|
|
|
@ -414,3 +414,17 @@ int mm_tlsio_read(mm_tlsio_t *io, char *buf, int size)
|
|||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
MACHINE_API int
|
||||
machine_set_tls(machine_io_t obj, machine_tls_t tls_obj)
|
||||
{
|
||||
mm_io_t *io = obj;
|
||||
if (io->tls_obj) {
|
||||
mm_io_set_errno(io, EINPROGRESS);
|
||||
return -1;
|
||||
}
|
||||
io->tls_obj = tls_obj;
|
||||
if (! io->connected)
|
||||
return 0;
|
||||
return mm_tlsio_connect(&io->tls, io->tls_obj);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue