]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
Use coroutine friendly pcall
authordaurnimator <quae@daurnimator.com>
Mon, 19 Dec 2016 04:44:16 +0000 (15:44 +1100)
committerOndřej Surý <ondrej@sury.org>
Mon, 19 Dec 2016 08:54:06 +0000 (09:54 +0100)
modules/http/http.lua

index ee1cf900987da01cb19aa29ad7f87fdd45b75e97..010f2062b2bd96cc41454980fdd2936bc14279d5 100644 (file)
@@ -13,6 +13,7 @@ local cqueues = require('cqueues')
 local server = require('http.server')
 local headers = require('http.headers')
 local websocket = require('http.websocket')
+local http_util = require "http.util"
 local x509, pkey = require('openssl.x509'), require('openssl.pkey')
 local has_mmdb, mmdb  = pcall(require, 'mmdb')
 
@@ -172,7 +173,7 @@ local function route(endpoints)
                        ws:close()
                        return
                else
-                       local ok, err, reason = pcall(serve, h, stream)
+                       local ok, err, reason = http_util.yieldable_pcall(serve, h, stream)
                        if not ok or err then
                                if err ~= '404' then
                                        log('[http] %s %s: %s (%s)', m, path, err or '500', reason)