Software /
code /
verse
Comparison
client.lua @ 199:33b54389ed9c
verse.client: Reopen stream in response to 'connected' event
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Fri, 18 Mar 2011 21:39:57 +0000 |
parent | 171:741f5311d30c |
child | 282:52b971d9ebc3 |
comparison
equal
deleted
inserted
replaced
198:f6702e7ce5f9 | 199:33b54389ed9c |
---|---|
70 if ok then return; end | 70 if ok then return; end |
71 self:debug("debug", "Received invalid XML (%s) %d bytes: %s", tostring(err), #data, data:sub(1, 300):gsub("[\r\n]+", " ")); | 71 self:debug("debug", "Received invalid XML (%s) %d bytes: %s", tostring(err), #data, data:sub(1, 300):gsub("[\r\n]+", " ")); |
72 self:close("xml-not-well-formed"); | 72 self:close("xml-not-well-formed"); |
73 end | 73 end |
74 | 74 |
75 self:hook("connected", function () self:reopen(); end); | |
75 self:hook("incoming-raw", function (data) return self.data(self.conn, data); end); | 76 self:hook("incoming-raw", function (data) return self.data(self.conn, data); end); |
76 | 77 |
77 self.curr_id = 0; | 78 self.curr_id = 0; |
78 | 79 |
79 self.tracked_iqs = {}; | 80 self.tracked_iqs = {}; |
134 end | 135 end |
135 | 136 |
136 local function start_connect() | 137 local function start_connect() |
137 -- Initialise connection | 138 -- Initialise connection |
138 self:connect(self.connect_host or self.host, self.connect_port or 5222); | 139 self:connect(self.connect_host or self.host, self.connect_port or 5222); |
139 self:reopen(); | |
140 end | 140 end |
141 | 141 |
142 if not (self.connect_host or self.connect_port) then | 142 if not (self.connect_host or self.connect_port) then |
143 -- Look up SRV records | 143 -- Look up SRV records |
144 adns.lookup(function (answer) | 144 adns.lookup(function (answer) |