Software /
code /
prosody
Comparison
net/websocket.lua @ 7759:69706084bdfe
net.websocket: Ignore unused argument warnings [luacheck]
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sun, 04 Dec 2016 11:58:16 +0100 |
parent | 6455:b6514e691a70 |
child | 8189:a3565d7dd304 |
comparison
equal
deleted
inserted
replaced
7757:437fb77e5ded | 7759:69706084bdfe |
---|---|
42 s:close(code, reason); | 42 s:close(code, reason); |
43 s.handler:close(); | 43 s.handler:close(); |
44 return false | 44 return false |
45 end | 45 end |
46 | 46 |
47 function websocket_listeners.onincoming(handler, buffer, err) | 47 function websocket_listeners.onincoming(handler, buffer, err) -- luacheck: ignore 212/err |
48 local s = websockets[handler]; | 48 local s = websockets[handler]; |
49 s.readbuffer = s.readbuffer..buffer; | 49 s.readbuffer = s.readbuffer..buffer; |
50 while true do | 50 while true do |
51 local frame, len = frames.parse(s.readbuffer); | 51 local frame, len = frames.parse(s.readbuffer); |
52 if frame == nil then break end | 52 if frame == nil then break end |
121 end | 121 end |
122 return true; | 122 return true; |
123 end | 123 end |
124 | 124 |
125 local websocket_methods = {}; | 125 local websocket_methods = {}; |
126 local function close_timeout_cb(now, timerid, s) | 126 local function close_timeout_cb(now, timerid, s) -- luacheck: ignore 212/now 212/timerid |
127 s.close_timer = nil; | 127 s.close_timer = nil; |
128 log("warn", "Close timeout waiting for server to close, closing manually."); | 128 log("warn", "Close timeout waiting for server to close, closing manually."); |
129 s.handler:close(); | 129 s.handler:close(); |
130 end | 130 end |
131 function websocket_methods:close(code, reason) | 131 function websocket_methods:close(code, reason) |
230 onmessage = listeners.onmessage; | 230 onmessage = listeners.onmessage; |
231 onerror = listeners.onerror; | 231 onerror = listeners.onerror; |
232 }, websocket_metatable); | 232 }, websocket_metatable); |
233 | 233 |
234 local http_url = url:gsub("^(ws)", "http"); | 234 local http_url = url:gsub("^(ws)", "http"); |
235 local http_req = http.request(http_url, { | 235 local http_req = http.request(http_url, { -- luacheck: ignore 211/http_req |
236 method = "GET"; | 236 method = "GET"; |
237 headers = headers; | 237 headers = headers; |
238 sslctx = ex.sslctx; | 238 sslctx = ex.sslctx; |
239 }, function(b, c, r, http_req) | 239 }, function(b, c, r, http_req) |
240 if c ~= 101 | 240 if c ~= 101 |