public
Description: A Ruby/Rails job server and scheduler
Homepage: http://backgroundrb.rubyforge.org
Clone URL: git://github.com/gnufied/backgroundrb.git
fix bug with marhalling large packetS
gnufied (author)
Sat Jun 07 03:15:01 -0700 2008
commit  4a2e3e3553f739af5afd74c9e433ddf9e5357e40
tree    c39490756cf74a90044e1088f09842b1c423faa3
parent  abff893eaab35186e077eba80bb887753dc0fa0a
...
102
103
104
 
105
106
107
...
144
145
146
147
148
149
150
151
 
 
 
 
152
153
154
 
 
 
 
 
 
 
 
 
 
 
 
 
155
156
157
...
174
175
176
177
 
178
179
180
...
102
103
104
105
106
107
108
...
145
146
147
 
148
 
 
 
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
...
188
189
190
 
191
192
193
194
0
@@ -102,6 +102,7 @@ class BackgrounDRb::WorkerProxy
0
 
0
   def close_connection
0
     @connection.close
0
+    @connection = nil
0
   end
0
 
0
   def ask_work p_data
0
@@ -144,14 +145,27 @@ class BackgrounDRb::WorkerProxy
0
   end
0
 
0
   def read_object
0
-    sock_data = ""
0
     begin
0
-      while(sock_data << @connection.read_nonblock(1023)); end
0
-    rescue Errno::EAGAIN
0
-      @tokenizer.extract(sock_data) { |b_data| return b_data }
0
+      message_length_str = @connection.read(9)
0
+      message_length = message_length_str.to_i
0
+      message_data = @connection.read(message_length)
0
+      return message_data
0
     rescue
0
       raise BackgrounDRb::BdrbConnError.new("Not able to connect")
0
     end
0
+
0
+   # begin
0
+   #   while(t_data = @connection.read_nonblock((16*1024)-1))
0
+   #     sock_data << t_data
0
+   #   end
0
+   #   return sock_data.join
0
+   # rescue Errno::EAGAIN
0
+   #   return sock_data.join
0
+   # rescue Errno::EWOULDBLOCK
0
+   #   return sock_data.join
0
+   # rescue
0
+   #   raise BackgrounDRb::BdrbConnError.new("Not able to connect",sock_data.join)
0
+   # end
0
   end
0
 
0
   def query_all_workers
0
@@ -174,7 +188,7 @@ class BackgrounDRb::WorkerProxy
0
   end
0
 
0
   def read_from_bdrb(timeout = 3)
0
-    @tokenizer = Packet::BinParser.new
0
+    #@tokenizer = Packet::BinParser.new
0
     begin
0
       ret_val = select([@connection],nil,nil,timeout)
0
       return nil unless ret_val

Comments