mirror of
https://github.com/koreader/koreader
synced 2024-11-10 01:10:34 +00:00
Merge pull request #909 from chrox/fix_hostname_unresolved
use calibre ip address returned by receivefrom
This commit is contained in:
commit
4e211e230f
@ -68,12 +68,12 @@ function CalibreCompanion:find_calibre_server()
|
||||
-- broadcast anything to calibre ports and listen to the reply
|
||||
local sent, err = udp:sendto("hello", "255.255.255.255", port)
|
||||
if not err then
|
||||
local dgram, err = udp:receivefrom()
|
||||
if dgram then
|
||||
local dgram, host = udp:receivefrom()
|
||||
if dgram and host then
|
||||
-- replied diagram has greet message from calibre and calibre hostname
|
||||
-- calibre opds port and calibre socket port we will later connect to
|
||||
local _, host, _, port = dgram:match("(.-)%(on (.-)%);(.-),(.-)$")
|
||||
return socket.dns.toip(host), port
|
||||
local _, hostname, _, port = dgram:match("(.-)%(on (.-)%);(.-),(.-)$")
|
||||
return host, port
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user