mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-07 07:37:02 +02:00
MINOR: hlua: Save the lua socket's server in its context
For the same reason than the timeout, the server used by a lua socket is now saved in its context. This will be mandatory to fix issues with the lua sockets.
This commit is contained in:
parent
0be1ae2fa2
commit
6f4041c75d
@ -278,6 +278,7 @@ struct hlua_csk_ctx {
|
||||
struct list wake_on_read;
|
||||
struct list wake_on_write;
|
||||
struct appctx *appctx;
|
||||
struct server *srv;
|
||||
int timeout;
|
||||
int die;
|
||||
};
|
||||
@ -3183,6 +3184,10 @@ __LJMP static int hlua_socket_connect(struct lua_State *L)
|
||||
return 1;
|
||||
}
|
||||
|
||||
csk_ctx = container_of(peer, struct hlua_csk_ctx, xref);
|
||||
if (!csk_ctx->srv)
|
||||
csk_ctx->srv = socket_tcp;
|
||||
|
||||
/* Parse ip address. */
|
||||
addr = str2sa_range(ip, NULL, &low, &high, NULL, NULL, NULL, NULL, NULL, PA_O_PORT_OK | PA_O_STREAM);
|
||||
if (!addr) {
|
||||
@ -3263,6 +3268,7 @@ __LJMP static int hlua_socket_connect_ssl(struct lua_State *L)
|
||||
}
|
||||
|
||||
s = appctx_strm(container_of(peer, struct hlua_csk_ctx, xref)->appctx);
|
||||
container_of(peer, struct hlua_csk_ctx, xref)->srv = socket_ssl;
|
||||
|
||||
s->target = &socket_ssl->obj_type;
|
||||
xref_unlock(&socket->xref, peer);
|
||||
@ -3378,6 +3384,7 @@ __LJMP static int hlua_socket_new(lua_State *L)
|
||||
ctx = applet_reserve_svcctx(appctx, sizeof(*ctx));
|
||||
ctx->connected = 0;
|
||||
ctx->die = 0;
|
||||
ctx->srv = NULL;
|
||||
ctx->timeout = 0;
|
||||
ctx->appctx = appctx;
|
||||
LIST_INIT(&ctx->wake_on_write);
|
||||
|
Loading…
Reference in New Issue
Block a user