packet 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -15,8 +15,14 @@ class DoubleKeyedHash
15
15
  end
16
16
 
17
17
  def delete(key)
18
- @keys1.delete(key)
19
- @internal_hash.delete(key)
18
+ t_key = @keys1[key]
19
+ if t_key
20
+ @keys1.delete(key)
21
+ @internal_hash.delete(t_key)
22
+ else
23
+ @keys1.delete_if { |key,value| value == key }
24
+ @internal_hash.delete(key)
25
+ end
20
26
  end
21
27
 
22
28
  def each
@@ -103,6 +103,10 @@ module Packet
103
103
  rescue
104
104
  end
105
105
  end
106
+
107
+ def next_turn &block
108
+ @on_next_tick = block
109
+ end
106
110
 
107
111
  # method opens a socket for listening
108
112
  def start_server(ip,port,t_module,&block)
@@ -119,6 +123,7 @@ module Packet
119
123
  Signal.trap("INT") { shutdown }
120
124
  loop do
121
125
  check_for_timer_events
126
+ @on_next_tick.call if @on_next_tick
122
127
  ready_read_fds,ready_write_fds,read_error_fds = select(read_ios,write_ios,nil,0.005)
123
128
 
124
129
  if ready_read_fds && !ready_read_fds.empty?
@@ -243,6 +248,7 @@ module Packet
243
248
  @connections ||= {}
244
249
  @listen_sockets ||= {}
245
250
  @binding = 0
251
+ @on_next_tick = nil
246
252
 
247
253
  # @timer_hash = Packet::TimerStore
248
254
  @timer_hash ||= {}
data/lib/packet.rb CHANGED
@@ -26,5 +26,5 @@ require "packet/packet_worker"
26
26
  PACKET_APP = File.expand_path'../' unless defined?(PACKET_APP)
27
27
 
28
28
  module Packet
29
- VERSION='0.1.4'
29
+ VERSION='0.1.5'
30
30
  end
data/lib/packet.rbc ADDED
Binary file
@@ -1,4 +1,5 @@
1
1
  require File.join(File.dirname(__FILE__) + "/spec_helper")
2
+
2
3
  context "Packet Core in general when mixed inside a class" do
3
4
  xspecify "allow the class to act as a reactor" do
4
5
  end
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.4
4
+ version: 0.1.5
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-02-12 00:00:00 +05:30
12
+ date: 2008-02-28 00:00:00 +05:30
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -50,6 +50,7 @@ files:
50
50
  - lib/packet/packet_event.rb
51
51
  - lib/packet/packet_nbio.rb
52
52
  - lib/packet.rb
53
+ - lib/packet.rbc
53
54
  - lib/packet_mongrel.rb
54
55
  - examples/concurrent_thread.c
55
56
  - examples/sample_server.rb