eventmachine 0.4.3 → 0.4.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  /*****************************************************************************
2
2
 
3
- $Id: binder.cpp 2291 2006-04-14 03:56:18Z francis $
3
+ $Id: binder.cpp 2381 2006-04-24 13:33:03Z francis $
4
4
 
5
5
  File: binder.cpp
6
6
  Date: 07Apr06
@@ -27,7 +27,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
27
27
  #include "project.h"
28
28
 
29
29
  #define DEV_URANDOM "/dev/urandom"
30
- #define DO_NOT_REQUIRE_UUID
31
30
 
32
31
 
33
32
  map<string, Bindable_t*> Bindable_t::BindingBag;
@@ -43,12 +42,6 @@ string Bindable_t::CreateBinding()
43
42
  static string seed;
44
43
 
45
44
  if ((index >= 1000000) || (seed.length() == 0)) {
46
- #ifdef REQUIRE_UUID
47
- uuid_t u;
48
- uuid_generate (u);
49
- #endif
50
-
51
- #ifdef DO_NOT_REQUIRE_UUID
52
45
  int fd = open (DEV_URANDOM, O_RDONLY);
53
46
  if (fd < 0)
54
47
  throw std::runtime_error ("No entropy device");
@@ -57,7 +50,6 @@ string Bindable_t::CreateBinding()
57
50
  size_t r = read (fd, u, sizeof(u));
58
51
  if (r < sizeof(u))
59
52
  throw std::runtime_error ("Unable to read entropy device");
60
- #endif
61
53
 
62
54
  unsigned char *u1 = (unsigned char*)u;
63
55
  char u2 [sizeof(u) * 2 + 1];
data/ext/ed.cpp CHANGED
@@ -1,6 +1,6 @@
1
1
  /*****************************************************************************
2
2
 
3
- $Id: ed.cpp 2363 2006-04-23 14:32:40Z francis $
3
+ $Id: ed.cpp 2382 2006-04-25 03:03:53Z francis $
4
4
 
5
5
  File: ed.cpp
6
6
  Date: 06Apr06
@@ -551,8 +551,10 @@ DatagramDescriptor::DatagramDescriptor
551
551
  **************************************/
552
552
 
553
553
  DatagramDescriptor::DatagramDescriptor (int sd):
554
- EventableDescriptor (sd)
554
+ EventableDescriptor (sd),
555
+ OutboundDataSize (0)
555
556
  {
557
+ bzero (&ReturnAddress, sizeof(ReturnAddress));
556
558
  }
557
559
 
558
560
 
@@ -731,7 +733,7 @@ int DatagramDescriptor::SendOutboundDatagram (const char *data, int length, cons
731
733
  unsigned long HostAddr;
732
734
 
733
735
  HostAddr = inet_addr (address);
734
- if (HostAddr == -1) {
736
+ if (HostAddr == INADDR_NONE) {
735
737
  hostent *hp = gethostbyname (address);
736
738
  if (!hp)
737
739
  return 0;
data/ext/ed.h CHANGED
@@ -1,6 +1,6 @@
1
1
  /*****************************************************************************
2
2
 
3
- $Id: ed.h 2363 2006-04-23 14:32:40Z francis $
3
+ $Id: ed.h 2378 2006-04-24 03:37:19Z francis $
4
4
 
5
5
  File: ed.h
6
6
  Date: 06Apr06
@@ -154,7 +154,7 @@ class DatagramDescriptor: public EventableDescriptor
154
154
 
155
155
  protected:
156
156
  struct OutboundPage {
157
- OutboundPage (const char *b, int l, struct sockaddr_in f, int o=0): Buffer(b), Length(l), From(f), Offset(o) {}
157
+ OutboundPage (const char *b, int l, struct sockaddr_in f, int o=0): Buffer(b), Length(l), Offset(o), From(f) {}
158
158
  void Free() {if (Buffer) free ((char*)Buffer); }
159
159
  const char *Buffer;
160
160
  int Length;
data/ext/em.cpp CHANGED
@@ -1,6 +1,6 @@
1
1
  /*****************************************************************************
2
2
 
3
- $Id: em.cpp 2363 2006-04-23 14:32:40Z francis $
3
+ $Id: em.cpp 2378 2006-04-24 03:37:19Z francis $
4
4
 
5
5
  File: ed.cpp
6
6
  Date: 06Apr06
@@ -281,7 +281,7 @@ const char *EventMachine_t::ConnectToServer (const char *server, int port)
281
281
  unsigned long HostAddr;
282
282
 
283
283
  HostAddr = inet_addr (server);
284
- if (HostAddr == -1) {
284
+ if (HostAddr == INADDR_NONE) {
285
285
  hostent *hp = gethostbyname (server);
286
286
  if (!hp)
287
287
  return NULL;
@@ -373,7 +373,7 @@ const char *EventMachine_t::CreateTcpServer (const char *server, int port)
373
373
 
374
374
  if (server && *server) {
375
375
  sin.sin_addr.s_addr = inet_addr (server);
376
- if (sin.sin_addr.s_addr == -1) {
376
+ if (sin.sin_addr.s_addr == INADDR_NONE) {
377
377
  hostent *hp = gethostbyname (server);
378
378
  if (hp == NULL) {
379
379
  //__warning ("hostname not resolved: ", server);
@@ -457,7 +457,7 @@ const char *EventMachine_t::OpenDatagramSocket (const char *address, int port)
457
457
 
458
458
  if (address && *address) {
459
459
  sin.sin_addr.s_addr = inet_addr (address);
460
- if (sin.sin_addr.s_addr == -1) {
460
+ if (sin.sin_addr.s_addr == INADDR_NONE) {
461
461
  hostent *hp = gethostbyname (address);
462
462
  if (hp == NULL)
463
463
  goto fail;
@@ -1,6 +1,6 @@
1
1
  /*****************************************************************************
2
2
 
3
- $Id: project.h 2355 2006-04-22 19:03:09Z francis $
3
+ $Id: project.h 2381 2006-04-24 13:33:03Z francis $
4
4
 
5
5
  File: project.h
6
6
  Date: 06Apr06
@@ -47,7 +47,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
47
47
  #include <netinet/in.h>
48
48
  #include <netinet/tcp.h>
49
49
  #include <arpa/inet.h>
50
- #include <uuid/uuid.h>
51
50
  using namespace std;
52
51
 
53
52
 
@@ -71,6 +71,7 @@ void *TRunEvma (void *v)
71
71
  {
72
72
  evma_run_machine();
73
73
  write (SyncSockets[1], "$", 1);
74
+ return NULL;
74
75
  }
75
76
 
76
77
 
@@ -86,14 +87,15 @@ static VALUE t_initialize_event_machine (VALUE self)
86
87
 
87
88
 
88
89
 
89
- /*************
90
+ /*****************************
90
91
  t_run_machine_without_threads
91
- *************/
92
+ *****************************/
92
93
 
93
94
  static VALUE t_run_machine_without_threads (VALUE self)
94
95
  {
95
96
  UseThreads = false;
96
97
  evma_run_machine();
98
+ return Qnil;
97
99
  }
98
100
 
99
101
 
@@ -184,7 +186,7 @@ t_send_data
184
186
  static VALUE t_send_data (VALUE self, VALUE signature, VALUE data, VALUE data_length)
185
187
  {
186
188
  int b = evma_send_data_to_connection (StringValuePtr (signature), StringValuePtr (data), FIX2INT (data_length));
187
- return (b << 1) | 1;
189
+ return INT2NUM (b);
188
190
  }
189
191
 
190
192
 
@@ -1,4 +1,4 @@
1
- # $Id: eventmachine.rb 2364 2006-04-23 16:11:13Z francis $
1
+ # $Id: eventmachine.rb 2380 2006-04-24 11:13:02Z francis $
2
2
  #
3
3
  # Author:: blackhedd (gmail address: garbagecat20).
4
4
  # Date:: 8 Apr 2006
@@ -14,7 +14,7 @@
14
14
  #
15
15
  # Copyright (C) 2006 by Francis Cianfrocca. All Rights Reserved.
16
16
  #
17
- # Gmail: garbagecat20
17
+ # Gmail: garbagecat10
18
18
  #
19
19
  # This program is free software; you can redistribute it and/or modify
20
20
  # it under the terms of the GNU General Public License as published by
@@ -64,7 +64,7 @@ require 'rubyeventmachine'
64
64
  # Here's a fully-functional echo server implemented in EventMachine:
65
65
  #
66
66
  # require 'rubygems'
67
- # require_gem 'eventmachine'
67
+ # require 'eventmachine'
68
68
  #
69
69
  # module EchoServer
70
70
  # def receive_data data
@@ -209,7 +209,7 @@ module EventMachine
209
209
  # with Ctrl-C.
210
210
  #
211
211
  # require 'rubygems'
212
- # require_gem 'eventmachine'
212
+ # require 'eventmachine'
213
213
  #
214
214
  # EventMachine::run {
215
215
  # puts "Starting the run now: #{Time.now}"
@@ -272,7 +272,7 @@ module EventMachine
272
272
  # === Usage example
273
273
  #
274
274
  # require 'rubygems'
275
- # require_gem 'eventmachine'
275
+ # require 'eventmachine'
276
276
  #
277
277
  # module Redmond
278
278
  #
@@ -370,7 +370,7 @@ module EventMachine
370
370
  # to the start_server call to values appropriate for your environment.
371
371
  #
372
372
  # require 'rubygems'
373
- # require_gem 'eventmachine'
373
+ # require 'eventmachine'
374
374
  #
375
375
  # module LineCounter
376
376
  #
@@ -431,7 +431,7 @@ module EventMachine
431
431
  # (and incidentally calls the connection's unbind method).
432
432
  #
433
433
  # require 'rubygems'
434
- # require_gem 'eventmachine'
434
+ # require 'eventmachine'
435
435
  #
436
436
  # module DumbHttpClient
437
437
  #
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.8.10
3
3
  specification_version: 1
4
4
  name: eventmachine
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.4.3
7
- date: 2006-04-23
6
+ version: 0.4.4
7
+ date: 2006-04-24
8
8
  summary: Ruby/EventMachine socket engine library
9
9
  require_paths:
10
10
  - lib