packet 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/packet/double_keyed_hash.rb +8 -2
- data/lib/packet/packet_core.rb +6 -0
- data/lib/packet.rb +1 -1
- data/lib/packet.rbc +0 -0
- data/spec/test_packet_core.rb +1 -0
- metadata +3 -2
@@ -15,8 +15,14 @@ class DoubleKeyedHash
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def delete(key)
|
18
|
-
@keys1
|
19
|
-
|
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
|
data/lib/packet/packet_core.rb
CHANGED
@@ -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
data/lib/packet.rbc
ADDED
Binary file
|
data/spec/test_packet_core.rb
CHANGED
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
|
+
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
|
+
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
|