Permalink
Browse files

Merge branch 'develop'

  • Loading branch information...
icarus75 committed Sep 27, 2011
2 parents 76c7187 + df6d728 commit b3eae684d0bcf863ca1f902f5cb26fc6fd9ad43a
@@ -3,7 +3,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=flukso
-PKG_VERSION:=2.1.2
+PKG_VERSION:=2.1.3
PKG_RELEASE:=1
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
@@ -83,9 +83,9 @@ local LAN_INTERVAL = 0
local LAN_POLISH_CUTOFF = 60
local LAN_PUBLISH_PATH = DAEMON_PATH .. '/sensor'
-local LAN_FACTOR = { ['electricity'] = 3.6e6, -- 1 Wh/ms = 3.6e6 W
- ['water'] = 86.6e6, -- 1 L/ms = 24 * 3.6e6 L/day
- ['gas'] = 86.6e6 } -- 1 L/ms = 24 * 3.6e6 L/day
+local LAN_FACTOR = { ['electricity'] = 3.6e6, -- 1 Wh/ms = 3.6e6 W
+ ['water'] = 24 * 3.6e6, -- 1 L/ms = 24 * 3.6e6 L/day
+ ['gas'] = 24 * 3.6e6 } -- 1 L/ms = 24 * 3.6e6 L/day
local LAN_ID_TO_FACTOR = { }
uci:foreach('flukso', 'sensor', function(x) LAN_ID_TO_FACTOR[x.id] = LAN_FACTOR[x['type']] end)
@@ -118,7 +118,14 @@ function create_persistent()
local status, response, buffer, sock
local function yield(...)
- if options.headers["Connection"] == "close" then
+ -- request_raw() will only return a socket userdatum after a successful call
+ -- a nil socket value implies that the socket has already been closed and
+ -- thus cannot be re-used for future calls
+ --
+ -- so the only case where we have to explicitely close the socket is when
+ -- the Connection header says so and a non-nil socket userdatum is returned
+ -- by request_raw()
+ if sock and options.headers["Connection"] == "close" then
sock:close()
end

0 comments on commit b3eae68

Please sign in to comment.