Skip to content

Commit 59508f8

Browse files
committed
ngx.ssl.session: use the FFI_ERROR constant for error handling.
1 parent b55ae61 commit 59508f8

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

lib/ngx/ssl/session.lua

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ local getfenv = getfenv
1111
local error = error
1212
local errmsg = base.get_errmsg_ptr()
1313
local get_string_buf = base.get_string_buf
14+
local FFI_ERROR = base.FFI_ERROR
1415

1516

1617
ffi.cdef[[
@@ -51,7 +52,7 @@ function _M.get_serialized_session()
5152

5253
local rc = C.ngx_http_lua_ffi_ssl_get_serialized_session(r, buf, errmsg)
5354

54-
if rc < 0 then
55+
if rc == FFI_ERROR then
5556
return nil, ffi_str(errmsg[0])
5657
end
5758

@@ -76,7 +77,7 @@ function _M.get_session_id()
7677

7778
local rc = C.ngx_http_lua_ffi_ssl_get_session_id(r, buf, errmsg)
7879

79-
if rc < 0 then
80+
if rc == FFI_ERROR then
8081
return nil, ffi_str(errmsg[0])
8182
end
8283

@@ -93,7 +94,7 @@ function _M.set_serialized_session(sess)
9394

9495
local rc = C.ngx_http_lua_ffi_ssl_set_serialized_session(r, sess, #sess,
9596
errmsg)
96-
if rc < 0 then
97+
if rc == FFI_ERROR then
9798
return nil, ffi_str(errmsg[0])
9899
end
99100

0 commit comments

Comments
 (0)