Author: richard
Date: Fri Apr  3 13:36:06 2009
New Revision: 5141

URL: http://svn.slimdevices.com/jive?rev=5141&view=rev
Log:
Bug: N/A
Description:
Fix jive connection issue. If a http socket is closed while an async dns 
request is happening, the socket would get into a bad state and 
stop working. This could cause connection problems with SN.


Modified:
    7.3/trunk/squeezeplay/src/squeezeplay/share/jive/net/SocketHttp.lua

Modified: 7.3/trunk/squeezeplay/src/squeezeplay/share/jive/net/SocketHttp.lua
URL: 
http://svn.slimdevices.com/jive/7.3/trunk/squeezeplay/src/squeezeplay/share/jive/net/SocketHttp.lua?rev=5141&r1=5140&r2=5141&view=diff
==============================================================================
--- 7.3/trunk/squeezeplay/src/squeezeplay/share/jive/net/SocketHttp.lua 
(original)
+++ 7.3/trunk/squeezeplay/src/squeezeplay/share/jive/net/SocketHttp.lua Fri Apr 
 3 13:36:06 2009
@@ -208,21 +208,27 @@
                return
        end
 
-       local t = Task(tostring(self) .. "(D)",
-                      self,
-                      function()
-                              log:debug(self, " DNS loopup for ", self.host)
-                              local ip, err = DNS:toip(self.host)
-
-                              log:debug(self, " IP=", ip)
-                              if not ip then
-                                      self:close(self.host .. " " .. err)
-                                      return
-                              end
-
-                              self.t_tcp.address = ip
-                              self:t_nextSendState(true, 't_sendConnect')
-                      end)
+       local t = Task(tostring(self) .. "(D)", self, function()
+               log:debug(self, " DNS loopup for ", self.host)
+               local ip, err = DNS:toip(self.host)
+
+               -- make sure the socket has not closed while
+               -- resolving DNS
+               if self.t_httpSendState ~= 't_sendResolve' then
+                       log:debug(self, " socket closed during DNS request")
+                       return
+               end
+
+               log:debug(self, " IP=", ip)
+               if not ip then
+               self:close(self.host .. " " .. err)
+                       return
+               end
+
+               self.t_tcp.address = ip
+               self:t_nextSendState(true, 't_sendConnect')
+       end)
+
        t:addTask()
 end
 

_______________________________________________
Jive-checkins mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/jive-checkins

Reply via email to