packet 0.1.14 → 0.1.15

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.14'
32
+ VERSION='0.1.15'
33
33
  end
@@ -0,0 +1,820 @@
1
+ !RBIX
2
+ 0
3
+ x
4
+ M
5
+ 1
6
+ n
7
+ n
8
+ x
9
+ 10
10
+ __script__
11
+ i
12
+ 339
13
+ 45
14
+ 26
15
+ 0
16
+ 6
17
+ 1
18
+ 36
19
+ 2
20
+ 1
21
+ 23
22
+ 3
23
+ 6
24
+ 4
25
+ 48
26
+ 36
27
+ 5
28
+ 1
29
+ 36
30
+ 6
31
+ 1
32
+ 15
33
+ 10
34
+ 47
35
+ 16
36
+ 45
37
+ 26
38
+ 0
39
+ 6
40
+ 1
41
+ 36
42
+ 7
43
+ 1
44
+ 23
45
+ 3
46
+ 23
47
+ 3
48
+ 6
49
+ 4
50
+ 48
51
+ 36
52
+ 8
53
+ 1
54
+ 36
55
+ 9
56
+ 1
57
+ 36
58
+ 10
59
+ 1
60
+ 10
61
+ 70
62
+ 45
63
+ 26
64
+ 0
65
+ 6
66
+ 1
67
+ 36
68
+ 11
69
+ 1
70
+ 23
71
+ 3
72
+ 6
73
+ 4
74
+ 48
75
+ 36
76
+ 12
77
+ 1
78
+ 36
79
+ 13
80
+ 1
81
+ 8
82
+ 71
83
+ 1
84
+ 16
85
+ 7
86
+ 6
87
+ 14
88
+ 48
89
+ 57
90
+ 1
91
+ 36
92
+ 15
93
+ 1
94
+ 16
95
+ 7
96
+ 6
97
+ 16
98
+ 48
99
+ 57
100
+ 1
101
+ 36
102
+ 17
103
+ 1
104
+ 16
105
+ 7
106
+ 6
107
+ 18
108
+ 48
109
+ 57
110
+ 1
111
+ 36
112
+ 19
113
+ 1
114
+ 16
115
+ 7
116
+ 6
117
+ 20
118
+ 48
119
+ 57
120
+ 1
121
+ 36
122
+ 21
123
+ 1
124
+ 16
125
+ 7
126
+ 6
127
+ 22
128
+ 48
129
+ 57
130
+ 1
131
+ 36
132
+ 23
133
+ 1
134
+ 16
135
+ 7
136
+ 6
137
+ 24
138
+ 48
139
+ 57
140
+ 1
141
+ 36
142
+ 25
143
+ 1
144
+ 16
145
+ 7
146
+ 6
147
+ 26
148
+ 48
149
+ 57
150
+ 1
151
+ 36
152
+ 27
153
+ 1
154
+ 16
155
+ 7
156
+ 6
157
+ 28
158
+ 48
159
+ 57
160
+ 1
161
+ 36
162
+ 29
163
+ 1
164
+ 16
165
+ 7
166
+ 6
167
+ 30
168
+ 48
169
+ 57
170
+ 1
171
+ 36
172
+ 31
173
+ 1
174
+ 16
175
+ 7
176
+ 6
177
+ 32
178
+ 48
179
+ 57
180
+ 1
181
+ 36
182
+ 33
183
+ 1
184
+ 16
185
+ 7
186
+ 6
187
+ 34
188
+ 48
189
+ 57
190
+ 1
191
+ 36
192
+ 35
193
+ 1
194
+ 16
195
+ 7
196
+ 6
197
+ 36
198
+ 48
199
+ 57
200
+ 1
201
+ 36
202
+ 37
203
+ 1
204
+ 16
205
+ 7
206
+ 6
207
+ 38
208
+ 48
209
+ 57
210
+ 1
211
+ 36
212
+ 39
213
+ 1
214
+ 16
215
+ 7
216
+ 6
217
+ 40
218
+ 48
219
+ 57
220
+ 1
221
+ 36
222
+ 41
223
+ 1
224
+ 16
225
+ 7
226
+ 6
227
+ 42
228
+ 48
229
+ 57
230
+ 1
231
+ 36
232
+ 43
233
+ 1
234
+ 16
235
+ 7
236
+ 6
237
+ 44
238
+ 48
239
+ 57
240
+ 1
241
+ 36
242
+ 45
243
+ 1
244
+ 16
245
+ 7
246
+ 6
247
+ 46
248
+ 48
249
+ 57
250
+ 1
251
+ 36
252
+ 47
253
+ 1
254
+ 16
255
+ 7
256
+ 6
257
+ 48
258
+ 48
259
+ 57
260
+ 1
261
+ 36
262
+ 49
263
+ 1
264
+ 16
265
+ 7
266
+ 6
267
+ 50
268
+ 48
269
+ 57
270
+ 1
271
+ 36
272
+ 51
273
+ 1
274
+ 16
275
+ 7
276
+ 6
277
+ 52
278
+ 48
279
+ 57
280
+ 1
281
+ 36
282
+ 53
283
+ 1
284
+ 16
285
+ 7
286
+ 6
287
+ 54
288
+ 48
289
+ 57
290
+ 1
291
+ 36
292
+ 55
293
+ 1
294
+ 16
295
+ 7
296
+ 6
297
+ 56
298
+ 48
299
+ 57
300
+ 1
301
+ 36
302
+ 57
303
+ 1
304
+ 16
305
+ 5
306
+ 6
307
+ 58
308
+ 36
309
+ 59
310
+ 1
311
+ 10
312
+ 303
313
+ 1
314
+ 8
315
+ 305
316
+ 6
317
+ 60
318
+ 10
319
+ 323
320
+ 5
321
+ 6
322
+ 58
323
+ 23
324
+ 3
325
+ 6
326
+ 61
327
+ 48
328
+ 36
329
+ 62
330
+ 1
331
+ 36
332
+ 63
333
+ 2
334
+ 8
335
+ 324
336
+ 1
337
+ 16
338
+ 31
339
+ 64
340
+ 15
341
+ 6
342
+ 65
343
+ 14
344
+ 27
345
+ 66
346
+ 16
347
+ 35
348
+ 67
349
+ 16
350
+ 2
351
+ 12
352
+ I
353
+ 6
354
+ I
355
+ 0
356
+ I
357
+ 0
358
+ I
359
+ 0
360
+ n
361
+ p
362
+ 68
363
+ x
364
+ 7
365
+ Globals
366
+ x
367
+ 2
368
+ $:
369
+ S
370
+ 2
371
+ []
372
+ x
373
+ 4
374
+ File
375
+ s
376
+ 33
377
+ /home/hemant/packet/lib/packet.rb
378
+ S
379
+ 7
380
+ dirname
381
+ S
382
+ 8
383
+ include?
384
+ S
385
+ 2
386
+ []
387
+ S
388
+ 7
389
+ dirname
390
+ S
391
+ 11
392
+ expand_path
393
+ S
394
+ 8
395
+ include?
396
+ S
397
+ 2
398
+ []
399
+ S
400
+ 7
401
+ dirname
402
+ S
403
+ 7
404
+ unshift
405
+ s
406
+ 6
407
+ socket
408
+ S
409
+ 7
410
+ require
411
+ s
412
+ 4
413
+ yaml
414
+ S
415
+ 7
416
+ require
417
+ s
418
+ 11
419
+ forwardable
420
+ S
421
+ 7
422
+ require
423
+ s
424
+ 7
425
+ ostruct
426
+ S
427
+ 7
428
+ require
429
+ s
430
+ 6
431
+ thread
432
+ S
433
+ 7
434
+ require
435
+ s
436
+ 5
437
+ fcntl
438
+ S
439
+ 7
440
+ require
441
+ s
442
+ 20
443
+ packet/packet_parser
444
+ S
445
+ 7
446
+ require
447
+ s
448
+ 28
449
+ packet/packet_invalid_worker
450
+ S
451
+ 7
452
+ require
453
+ s
454
+ 18
455
+ packet/packet_guid
456
+ S
457
+ 7
458
+ require
459
+ s
460
+ 20
461
+ packet/packet_helper
462
+ S
463
+ 7
464
+ require
465
+ s
466
+ 24
467
+ packet/double_keyed_hash
468
+ S
469
+ 7
470
+ require
471
+ s
472
+ 19
473
+ packet/packet_event
474
+ S
475
+ 7
476
+ require
477
+ s
478
+ 28
479
+ packet/packet_periodic_event
480
+ S
481
+ 7
482
+ require
483
+ s
484
+ 23
485
+ packet/disconnect_error
486
+ S
487
+ 7
488
+ require
489
+ s
490
+ 22
491
+ packet/packet_callback
492
+ S
493
+ 7
494
+ require
495
+ s
496
+ 18
497
+ packet/packet_nbio
498
+ S
499
+ 7
500
+ require
501
+ s
502
+ 18
503
+ packet/packet_pimp
504
+ S
505
+ 7
506
+ require
507
+ s
508
+ 23
509
+ packet/packet_meta_pimp
510
+ S
511
+ 7
512
+ require
513
+ s
514
+ 18
515
+ packet/packet_core
516
+ S
517
+ 7
518
+ require
519
+ s
520
+ 20
521
+ packet/packet_master
522
+ S
523
+ 7
524
+ require
525
+ s
526
+ 24
527
+ packet/packet_connection
528
+ S
529
+ 7
530
+ require
531
+ s
532
+ 20
533
+ packet/packet_worker
534
+ S
535
+ 7
536
+ require
537
+ x
538
+ 10
539
+ PACKET_APP
540
+ S
541
+ 14
542
+ const_defined?
543
+ s
544
+ 8
545
+ constant
546
+ s
547
+ 3
548
+ ../
549
+ S
550
+ 11
551
+ expand_path
552
+ S
553
+ 13
554
+ __const_set__
555
+ x
556
+ 6
557
+ Packet
558
+ M
559
+ 1
560
+ n
561
+ n
562
+ x
563
+ 6
564
+ Packet
565
+ i
566
+ 12
567
+ 7
568
+ 83
569
+ 5
570
+ 6
571
+ 0
572
+ 6
573
+ 1
574
+ 48
575
+ 36
576
+ 2
577
+ 2
578
+ 12
579
+ I
580
+ 3
581
+ I
582
+ 0
583
+ I
584
+ 0
585
+ I
586
+ 0
587
+ n
588
+ p
589
+ 3
590
+ x
591
+ 7
592
+ VERSION
593
+ s
594
+ 6
595
+ 0.1.14
596
+ S
597
+ 13
598
+ __const_set__
599
+ p
600
+ 0
601
+ p
602
+ 1
603
+ p
604
+ 3
605
+ I
606
+ 0
607
+ I
608
+ 12
609
+ I
610
+ 29
611
+ x
612
+ 33
613
+ /home/hemant/packet/lib/packet.rb
614
+ n
615
+ x
616
+ 15
617
+ __module_init__
618
+ S
619
+ 15
620
+ __module_init__
621
+ p
622
+ 0
623
+ p
624
+ 24
625
+ p
626
+ 3
627
+ I
628
+ 0
629
+ I
630
+ 48
631
+ I
632
+ 2
633
+ p
634
+ 3
635
+ I
636
+ 49
637
+ I
638
+ 71
639
+ I
640
+ 1
641
+ p
642
+ 3
643
+ I
644
+ 72
645
+ I
646
+ 81
647
+ I
648
+ 5
649
+ p
650
+ 3
651
+ I
652
+ 82
653
+ I
654
+ 91
655
+ I
656
+ 6
657
+ p
658
+ 3
659
+ I
660
+ 92
661
+ I
662
+ 101
663
+ I
664
+ 7
665
+ p
666
+ 3
667
+ I
668
+ 102
669
+ I
670
+ 111
671
+ I
672
+ 8
673
+ p
674
+ 3
675
+ I
676
+ 112
677
+ I
678
+ 121
679
+ I
680
+ 9
681
+ p
682
+ 3
683
+ I
684
+ 122
685
+ I
686
+ 131
687
+ I
688
+ 10
689
+ p
690
+ 3
691
+ I
692
+ 132
693
+ I
694
+ 141
695
+ I
696
+ 13
697
+ p
698
+ 3
699
+ I
700
+ 142
701
+ I
702
+ 151
703
+ I
704
+ 14
705
+ p
706
+ 3
707
+ I
708
+ 152
709
+ I
710
+ 161
711
+ I
712
+ 15
713
+ p
714
+ 3
715
+ I
716
+ 162
717
+ I
718
+ 171
719
+ I
720
+ 16
721
+ p
722
+ 3
723
+ I
724
+ 172
725
+ I
726
+ 181
727
+ I
728
+ 17
729
+ p
730
+ 3
731
+ I
732
+ 182
733
+ I
734
+ 191
735
+ I
736
+ 18
737
+ p
738
+ 3
739
+ I
740
+ 192
741
+ I
742
+ 201
743
+ I
744
+ 19
745
+ p
746
+ 3
747
+ I
748
+ 202
749
+ I
750
+ 211
751
+ I
752
+ 20
753
+ p
754
+ 3
755
+ I
756
+ 212
757
+ I
758
+ 221
759
+ I
760
+ 21
761
+ p
762
+ 3
763
+ I
764
+ 222
765
+ I
766
+ 231
767
+ I
768
+ 22
769
+ p
770
+ 3
771
+ I
772
+ 232
773
+ I
774
+ 241
775
+ I
776
+ 23
777
+ p
778
+ 3
779
+ I
780
+ 242
781
+ I
782
+ 251
783
+ I
784
+ 24
785
+ p
786
+ 3
787
+ I
788
+ 252
789
+ I
790
+ 261
791
+ I
792
+ 25
793
+ p
794
+ 3
795
+ I
796
+ 262
797
+ I
798
+ 271
799
+ I
800
+ 26
801
+ p
802
+ 3
803
+ I
804
+ 272
805
+ I
806
+ 281
807
+ I
808
+ 27
809
+ p
810
+ 3
811
+ I
812
+ 282
813
+ I
814
+ 339
815
+ I
816
+ 29
817
+ x
818
+ 33
819
+ /home/hemant/packet/lib/packet.rb
820
+ n
@@ -109,17 +109,16 @@ module Packet
109
109
  [worker_read_end,worker_write_end].each { |x| enable_nonblock(x) }
110
110
  begin
111
111
  if(ARGV[0] == 'start' && Object.const_defined?(:SERVER_LOGGER))
112
- log_file = File.open(SERVER_LOGGER,"a+")
113
- [STDIN, STDOUT, STDERR].each {|desc| desc.reopen(log_file)}
112
+ redirect_io(SERVER_LOGGER)
114
113
  end
115
- rescue; end
114
+ rescue
115
+ puts $!.backtrace
116
+ end
116
117
  exec form_cmd_line(worker_read_end.fileno,worker_write_end.fileno,t_worker_name,option_dump_length)
117
118
  end
118
119
  Process.detach(pid)
119
120
  [master_read_end,master_write_end].each { |x| enable_nonblock(x) }
120
121
 
121
-
122
-
123
122
  if worker_pimp && !worker_pimp.empty?
124
123
  require worker_pimp
125
124
  pimp_klass = Object.const_get(packet_classify(worker_pimp))
@@ -128,6 +127,7 @@ module Packet
128
127
  t_pimp = Packet::MetaPimp.new(master_write_end,pid,self)
129
128
  t_pimp.worker_key = worker_name_key
130
129
  t_pimp.worker_name = t_worker_name
130
+ t_pimp.invokable_worker_methods = worker_klass.instance_methods
131
131
  @live_workers[worker_name_key,master_read_end.fileno] = t_pimp
132
132
  end
133
133
 
@@ -136,6 +136,27 @@ module Packet
136
136
  read_ios << master_read_end
137
137
  end # end of fork_and_load method
138
138
 
139
+ # Free file descriptors and
140
+ # point them somewhere sensible
141
+ # STDOUT/STDERR should go to a logfile
142
+ def redirect_io(logfile_name)
143
+ begin; STDIN.reopen "/dev/null"; rescue ::Exception; end
144
+
145
+ if logfile_name
146
+ begin
147
+ STDOUT.reopen logfile_name, "a"
148
+ STDOUT.sync = true
149
+ rescue ::Exception
150
+ begin; STDOUT.reopen "/dev/null"; rescue ::Exception; end
151
+ end
152
+ else
153
+ begin; STDOUT.reopen "/dev/null"; rescue ::Exception; end
154
+ end
155
+
156
+ begin; STDERR.reopen STDOUT; rescue ::Exception; end
157
+ STDERR.sync = true
158
+ end
159
+
139
160
  def form_cmd_line *args
140
161
  min_string = "packet_worker_runner #{args[0]}:#{args[1]}:#{args[2]}:#{args[3]}"
141
162
  min_string << ":#{WORKER_ROOT}" if defined? WORKER_ROOT
@@ -6,6 +6,8 @@ class Packet::MetaPimp < Packet::Pimp
6
6
  # initializer of pimp
7
7
  attr_accessor :callback_hash
8
8
  attr_accessor :worker_status, :worker_key,:worker_name
9
+ attr_accessor :invokable_worker_methods
10
+
9
11
  def pimp_init
10
12
  @callback_hash ||= {}
11
13
  @worker_status = nil
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.14
4
+ version: 0.1.15
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-10-04 00:00:00 +05:30
12
+ date: 2009-04-07 00:00:00 +05:30
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -48,6 +48,7 @@ files:
48
48
  - lib/packet/packet_event.rb
49
49
  - lib/packet/packet_nbio.rb
50
50
  - lib/packet.rb
51
+ - lib/packet.rbc
51
52
  - lib/packet_mongrel.rb
52
53
  - examples/concurrent_thread.c
53
54
  - examples/sample_server.rb
@@ -80,7 +81,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
80
81
  requirements: []
81
82
 
82
83
  rubyforge_project:
83
- rubygems_version: 1.3.0
84
+ rubygems_version: 1.3.1
84
85
  signing_key:
85
86
  specification_version: 2
86
87
  summary: Packet, A Pure Ruby library for Event Driven Network Programming.