整理stream处理流程,适应KNI接口定义。
This commit is contained in:
@@ -12,6 +12,8 @@
|
||||
#include <event2/listener.h>
|
||||
#include <pthread.h>
|
||||
#include <assert.h>
|
||||
#include <proxy.h>
|
||||
#include <kni.h>
|
||||
|
||||
#ifndef TFE_CONFIG_KNI_UXDOMAIN_PATH_DEFAULT
|
||||
#define TFE_CONFIG_KNI_UXDOMAIN_PATH_DEFAULT "/var/run/.tfe_kni_acceptor_handler"
|
||||
@@ -38,6 +40,7 @@ struct kni_tlv_info
|
||||
struct kni_acceptor_ctx
|
||||
{
|
||||
/* INPUT */
|
||||
struct tfe_proxy * proxy;
|
||||
const char * profile;
|
||||
void * logger;
|
||||
|
||||
@@ -68,7 +71,8 @@ void __kni_event_cb(evutil_socket_t fd, short what, void * user)
|
||||
{
|
||||
struct kni_acceptor_ctx * __ctx = (struct kni_acceptor_ctx *)user;
|
||||
struct cmsghdr * __cmsghdr;
|
||||
int * __fds;
|
||||
struct tfe_proxy_accept_para __accept_para;
|
||||
int * __fds = NULL;
|
||||
|
||||
assert(__ctx != NULL && __ctx->thread == pthread_self());
|
||||
assert(what & EV_READ);
|
||||
@@ -134,7 +138,15 @@ void __kni_event_cb(evutil_socket_t fd, short what, void * user)
|
||||
goto __close_kni_connection;
|
||||
}
|
||||
|
||||
/* Call Proxy's Callback */
|
||||
__accept_para.session_type = __session_proto;
|
||||
__accept_para.downstream_fd = __fds[0];
|
||||
__accept_para.upstream_fd = __fds[1];
|
||||
|
||||
if (tfe_proxy_fds_accept(__ctx->proxy, &__accept_para) < 0)
|
||||
{
|
||||
goto __drop_recieved_fds;
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
__close_kni_connection:
|
||||
@@ -227,7 +239,7 @@ void kni_acceptor_deinit(struct kni_acceptor_ctx *ctx)
|
||||
return;
|
||||
}
|
||||
|
||||
struct kni_acceptor_ctx * kni_acceptor_init(const char *profile, void *logger)
|
||||
struct kni_acceptor_ctx * kni_acceptor_init(struct tfe_proxy *proxy, const char *profile, void *logger)
|
||||
{
|
||||
struct kni_acceptor_ctx * __ctx = ALLOC(struct kni_acceptor_ctx, 1);
|
||||
struct sockaddr_un __sockaddr_un;
|
||||
|
||||
Reference in New Issue
Block a user