Author: titmuss
Date: Tue Jan 15 05:43:57 2008
New Revision: 1443

URL: http://svn.slimdevices.com?rev=1443&root=Jive&view=rev
Log:
Bug: N/A
Description:
Comet code does not need to use HttpPool, it can use SocketHttp directly.


Modified:
    trunk/jive/src/pkg/jive/share/jive/net/Comet.lua
    trunk/jive/src/pkg/jive/share/jive/net/SocketHttp.lua

Modified: trunk/jive/src/pkg/jive/share/jive/net/Comet.lua
URL: 
http://svn.slimdevices.com/trunk/jive/src/pkg/jive/share/jive/net/Comet.lua?rev=1443&root=Jive&r1=1442&r2=1443&view=diff
==============================================================================
--- trunk/jive/src/pkg/jive/share/jive/net/Comet.lua (original)
+++ trunk/jive/src/pkg/jive/share/jive/net/Comet.lua Tue Jan 15 05:43:57 2008
@@ -105,8 +105,11 @@
        obj.uri = 'http://' .. ip .. ':' .. port .. path
        
        -- Comet uses 2 pools, 1 for chunked responses and 1 for requests
-       obj.cpool          = HttpPool(jnt, name .. "_Chunked", ip, port, 1, 1, 
Task.PRIORITY_HIGH)
-       obj.rpool          = HttpPool(jnt, name .. "_Request", ip, port, 1, 1, 
Task.PRIORITY_HIGH)
+       obj.chttp          = SocketHttp(jnt, ip, port, name .. "_Chunked")
+       obj.rhttp          = SocketHttp(jnt, ip, port, name .. "_Request")
+
+       obj.chttp:setPriority(Task.PRIORITY_HIGH)
+       obj.rhttp:setPriority(Task.PRIORITY_HIGH)
        
        obj.jnt            = jnt
        obj.name           = name
@@ -164,15 +167,13 @@
                        clientId = self.clientId,
                } }
 
-               local req = function()          
-                       return CometRequest(
+               local req = CometRequest(
                                _getEventSink(self),
                                self.uri,
                                data
                        )
-               end
-
-               self.rpool:queue(req)
+
+               self.rhttp:fetch(req)
        end
 end
 
@@ -295,15 +296,13 @@
        -- This will be our last request on this connection, it is now only
        -- for listening for responses
 
-       local req = function()
-               return CometRequest(
+       local req = CometRequest(
                        _getEventSink(self),
                        self.uri,
                        data
                )
-       end
-       
-       self.cpool:queue(req)
+       
+       self.chttp:fetch(req)
 end
 
 _getEventSink = function(self)
@@ -443,15 +442,13 @@
        -- XXX: according to the spec this should be sent as 
application/x-www-form-urlencoded
        -- with message=<url-encoded json> but it works as straight JSON
        
-       local req = function()
-               return CometRequest(
+       local req = CometRequest(
                        _getHandshakeSink(self),
                        self.uri,
                        data
                )
-       end
-       
-       self.cpool:queue(req)
+       
+       self.chttp:fetch(req)
 end
 
 _getHandshakeSink = function(self)
@@ -521,15 +518,13 @@
                                debug.dump(data, 5)
                        end
 
-                       local req = function()
-                               return CometRequest(
+                       local req = CometRequest(
                                        _getEventSink(self),
                                        self.uri,
                                        data
                                )
-                       end
-
-                       self.rpool:queue(req)
+
+                       self.rhttp:fetch(req)
                end
        end
 end
@@ -572,16 +567,14 @@
                                        debug.dump(data, 5)
                                end
 
-                               local req = function()
-                                       return CometRequest(
+                               local req = CometRequest(
                                                _getEventSink(self),
                                                self.uri,
                                                data
                                        )
-                               end
 
                                -- unsubscribe doesn't need to be high priority 
                                        
-                               self.rpool:queue(req)
+                               self.rhttp:fetch(req)
                        end
                end
        end
@@ -629,15 +622,13 @@
                        sink = _getRequestSink(self, func, id)
                end
        
-               local req = function()
-                       return CometRequest(
+               local req = CometRequest(
                                sink,
                                self.uri,
                                data
                        )
-               end
-       
-               self.rpool:queue(req)
+       
+               self.rhttp:fetch(req)
        
                -- If we expect a response, we will get the response on the 
persistent 
                -- connection.  Store our callback for later
@@ -786,15 +777,13 @@
                connectionType = 'streaming',
        } }
        
-       local req = function()
-               return CometRequest(
+       local req = CometRequest(
                        _getEventSink(self),
                        self.uri,
                        data
                )
-       end
-       
-       self.cpool:queue(req)   
+       
+       self.chttp:fetch(req)   
 end
 
 -- Notify changes in connection state
@@ -812,8 +801,8 @@
                self.jnt:notify('cometConnected', self)
        else
                -- force connections closed
-               self.cpool:close()
-               self.rpool:close()
+               self.chttp:close()
+               self.rhttp:close()
 
                self.jnt:notify('cometDisconnected', self, #self.pending_reqs)
        end
@@ -843,15 +832,13 @@
                        debug.dump(data, 5)
                end
 
-               local req = function()
-                       return CometRequest(
+               local req = CometRequest(
                                _getEventSink(self),
                                self.uri,
                                data
                        )
-               end
-
-               self.rpool:queue(req)
+
+               self.rhttp:fetch(req)
        end
 end
 

Modified: trunk/jive/src/pkg/jive/share/jive/net/SocketHttp.lua
URL: 
http://svn.slimdevices.com/trunk/jive/src/pkg/jive/share/jive/net/SocketHttp.lua?rev=1443&root=Jive&r1=1442&r2=1443&view=diff
==============================================================================
--- trunk/jive/src/pkg/jive/share/jive/net/SocketHttp.lua (original)
+++ trunk/jive/src/pkg/jive/share/jive/net/SocketHttp.lua Tue Jan 15 05:43:57 
2008
@@ -103,14 +103,6 @@
 --]]
 function fetch(self, request)
        _assert(oo.instanceof(request, RequestHttp), tostring(self) .. 
":fetch() parameter must be RequestHttp - " .. type(request) .. " - ".. 
debug.traceback())
-       self:t_fetch(request)
-end
-
-
--- t_fetch
--- fetches a request (network thread side)
-function t_fetch(self, request)
-       
        -- push the request
        table.insert(self.t_httpSendRequests, request)
 

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

Reply via email to