goto no_peer;
csk_ctx = container_of(peer, struct hlua_csk_ctx, xref);
+ if (!csk_ctx->connected)
+ goto connection_closed;
+
appctx = csk_ctx->appctx;
s = appctx_strm(appctx);
}
csk_ctx = container_of(peer, struct hlua_csk_ctx, xref);
+ if (!csk_ctx->connected) {
+ xref_unlock(&socket->xref, peer);
+ lua_pushinteger(L, -1);
+ return 1;
+ }
+
appctx = csk_ctx->appctx;
sc = appctx_sc(appctx);
s = __sc_strm(sc);
{
struct hlua_socket *socket;
struct xref *peer;
+ struct hlua_csk_ctx *csk_ctx;
struct appctx *appctx;
struct stconn *sc;
const struct sockaddr_storage *dst;
return 1;
}
- appctx = container_of(peer, struct hlua_csk_ctx, xref)->appctx;
+ csk_ctx = container_of(peer, struct hlua_csk_ctx, xref);
+ if (!csk_ctx->connected) {
+ xref_unlock(&socket->xref, peer);
+ lua_pushnil(L);
+ return 1;
+ }
+
+ appctx = csk_ctx->appctx;
sc = appctx_sc(appctx);
dst = sc_dst(sc_opposite(sc));
if (!dst) {
struct connection *conn;
struct appctx *appctx;
struct xref *peer;
+ struct hlua_csk_ctx *csk_ctx;
struct stream *s;
int ret;
return 1;
}
- appctx = container_of(peer, struct hlua_csk_ctx, xref)->appctx;
+ csk_ctx = container_of(peer, struct hlua_csk_ctx, xref);
+ if (!csk_ctx->connected) {
+ xref_unlock(&socket->xref, peer);
+ lua_pushnil(L);
+ return 1;
+ }
+
+ appctx = csk_ctx->appctx;
s = appctx_strm(appctx);
conn = sc_conn(s->scb);