-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #27 from xHasKx/dvv-patch-1
Dvv patch 1 - copas support
- Loading branch information
Showing
8 changed files
with
131 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
-- DOC: https://keplerproject.github.io/copas/ | ||
-- NOTE: you will need to install copas like this: luarocks install copas | ||
|
||
-- module table | ||
local connector = {} | ||
|
||
local socket = require("socket") | ||
local copas = require("copas") | ||
|
||
-- Open network connection to .host and .port in conn table | ||
-- Store opened socket to conn table | ||
-- Returns true on success, or false and error text on failure | ||
function connector.connect(conn) | ||
local sock, err = socket.connect(conn.host, conn.port) | ||
if not sock then | ||
return false, "socket.connect failed: "..err | ||
end | ||
conn.sock = sock | ||
return true | ||
end | ||
|
||
-- Shutdown network connection | ||
function connector.shutdown(conn) | ||
conn.sock:shutdown() | ||
end | ||
|
||
-- Send data to network connection | ||
function connector.send(conn, data, i, j) | ||
local ok, err = copas.send(conn.sock, data, i, j) | ||
return ok, err | ||
end | ||
|
||
-- Receive given amount of data from network connection | ||
function connector.receive(conn, size) | ||
local ok, err = copas.receive(conn.sock, size) | ||
return ok, err | ||
end | ||
|
||
-- Set connection's socket to non-blocking mode and set a timeout for it | ||
function connector.settimeout(conn, timeout) | ||
conn.timeout = timeout | ||
conn.sock:settimeout(0) | ||
end | ||
|
||
-- export module table | ||
return connector | ||
|
||
-- vim: ts=4 sts=4 sw=4 noet ft=lua |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
include $(TOPDIR)/rules.mk | ||
|
||
PKG_NAME:=luamqtt | ||
PKG_VERSION:=3.3.2 | ||
PKG_VERSION:=3.4.1 | ||
PKG_RELEASE:=1 | ||
PKG_MAINTAINER:=Alexander Kiranov <[email protected]> | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters