packet 0.1.10 → 0.1.11

Sign up to get free protection for your applications and to get access to all the features.
@@ -29,5 +29,5 @@ require "packet/packet_worker"
29
29
  PACKET_APP = File.expand_path'../' unless defined?(PACKET_APP)
30
30
 
31
31
  module Packet
32
- VERSION='0.1.10'
32
+ VERSION='0.1.11'
33
33
  end
@@ -87,12 +87,12 @@ module Packet
87
87
  rescue Errno::ECONNREFUSED
88
88
  actually_connected = false
89
89
  end
90
-
90
+ connection_completion_awaited.delete(t_sock.fileno)
91
91
  read_ios << t_sock if actually_connected
92
92
  write_ios.delete(t_sock)
93
93
  decorate_handler(t_sock,actually_connected,sock_opts[:sock_addr],\
94
94
  sock_opts[:module],&sock_opts[:block])
95
- connection_completion_awaited.delete(t_sock.fileno)
95
+
96
96
  end
97
97
 
98
98
  # method removes the connection and closes the socket
@@ -100,8 +100,10 @@ module Packet
100
100
  read_ios.delete(t_sock)
101
101
  write_ios.delete(t_sock)
102
102
  begin
103
- connections.delete(t_sock.fileno)
104
- t_sock.close
103
+ unless t_sock.closed?
104
+ connections.delete(t_sock.fileno)
105
+ t_sock.close
106
+ end
105
107
  rescue
106
108
  puts "#{$!.message}"
107
109
  end
@@ -284,11 +286,14 @@ module Packet
284
286
  end
285
287
 
286
288
  def check_for_timer_events
287
- @timer_hash.each do |key,timer|
288
- @timer_hash.delete(key) if timer.cancel_flag
289
- if timer.run_now?
289
+ @timer_hash.delete_if do |key,timer|
290
+ if timer.cancel_flag
291
+ true
292
+ elsif timer.run_now?
290
293
  timer.run
291
- @timer_hash.delete(key) if !timer.respond_to?(:interval)
294
+ (timer.respond_to?(:interval)) ? false : true
295
+ else
296
+ false
292
297
  end
293
298
  end
294
299
  end
@@ -323,6 +328,7 @@ module Packet
323
328
  handler_instance.invoke_init unless handler_instance.initialized
324
329
  unless actually_connected
325
330
  handler_instance.unbind
331
+ remove_connection(t_socket)
326
332
  return
327
333
  end
328
334
  handler_instance.signature = binding_str
@@ -330,7 +336,7 @@ module Packet
330
336
  # klass = Struct.new(:socket,:instance,:signature,:sock_addr)
331
337
  connection_data = { :socket => t_socket,:instance => handler_instance,:signature => binding_str,:sock_addr => sock_addr }
332
338
  connections[t_socket.fileno] = connection_data
333
- # connections[t_socket.fileno] = klass.new(t_socket,handler_instance,handler_instance.signature,sock_addr)
339
+ # connections[t_socket.fileno] = klass.new(t_socket,handler_instance,handler_instance.signature,sock_addr)
334
340
 
335
341
  block.call(handler_instance) if block
336
342
  handler_instance.connection_completed #if handler_instance.respond_to?(:connection_completed)
@@ -1,6 +1,7 @@
1
1
  # Class acts as a pimp for workers, which doesn't have a manually created pimp
2
2
  # The idea behind a manually added pimp is to let client handle low level messaging
3
3
  # beween workers. A meta pimp, does it for you.
4
+
4
5
  class Packet::MetaPimp < Packet::Pimp
5
6
  # initializer of pimp
6
7
  attr_accessor :callback_hash
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: packet
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.10
4
+ version: 0.1.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hemant Kumar
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-07-26 00:00:00 +05:30
12
+ date: 2008-08-29 00:00:00 +05:30
13
13
  default_executable:
14
14
  dependencies: []
15
15