distribustream 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
data/bin/dsclient CHANGED
@@ -117,4 +117,4 @@ class Callbacks < PDTP::Client::Callbacks
117
117
  end
118
118
 
119
119
  client = PDTP::Client.new uri.host, uri.port || 6086, :listen_port => listen_port
120
- client.connect Callbacks, uri, output
120
+ client.connect Callbacks.new(uri, output)
@@ -2,7 +2,7 @@ require 'rubygems'
2
2
 
3
3
  GEMSPEC = Gem::Specification.new do |s|
4
4
  s.name = "distribustream"
5
- s.version = "0.3.0"
5
+ s.version = "0.3.1"
6
6
  s.date = "2008-11-09"
7
7
  s.summary = "DistribuStream is a fully open peercasting system allowing on-demand or live streaming media to be delivered at a fraction of the normal cost"
8
8
  s.email = "tony@clickcaster.com"
@@ -121,6 +121,7 @@ module PDTP
121
121
  vhost=@request.params["HTTP_HOST"]
122
122
  @url="http://"+vhost+path
123
123
 
124
+ return unless request.params["HTTP_RANGE"]
124
125
  @byte_range=parse_http_range(request.params["HTTP_RANGE"])
125
126
  @peer_id=@request.params["HTTP_X_PDTP_PEER_ID"]
126
127
 
data/lib/pdtp/client.rb CHANGED
@@ -65,30 +65,21 @@ module PDTP
65
65
  end
66
66
 
67
67
  # Connect to the PDTP server. This is a blocking call which runs the client event loop
68
- def connect(callbacks = nil, *args)
69
- klass = if(callbacks and callbacks.is_a?(Class))
70
- callbacks
71
- else
72
- Class.new(Callbacks) {callbacks and include callbacks}
73
- end
68
+ def connect(callbacks = nil)
69
+ callbacks = Callbacks.new if callbacks.nil?
74
70
 
75
- arity = klass.instance_method(:initialize).arity
76
- expected = arity >= 0 ? arity : -(arity + 1)
77
- if (arity >= 0 and args.size != expected) or (arity < 0 and args.size < expected)
78
- raise ArgumentError, "wrong number of arguments for #{klass}#initialize (#{args.size} for #{expected})"
71
+ unless callbacks.is_a?(Callbacks)
72
+ raise ArgumentError, "callbacks must be an instance of PDTP::Client::Callbacks"
79
73
  end
80
-
74
+
81
75
  # Run the EventMachine reactor loop
82
76
  EventMachine.run do
83
77
  @http_server.run_evented
84
78
 
85
- EventMachine.connect(@host, @port, Connection) do |c|
86
- # Store reference to the connection
87
- @connection = c
88
-
79
+ @connection = EventMachine.connect(@host, @port, Connection) do |c|
89
80
  # Set connection variables and configure callbacks
90
81
  c.client = self
91
- c.callbacks = klass.new *args
82
+ c.callbacks = callbacks
92
83
  end
93
84
 
94
85
  #@@log.info "connecting with ev=#{EventMachine::VERSION}"
@@ -98,7 +89,7 @@ module PDTP
98
89
 
99
90
  # Are we currently connected to a server?
100
91
  def connected?
101
- !!@connection
92
+ not @connection.nil?
102
93
  end
103
94
 
104
95
  # Retrieve the resource at the given path and write it to the given IO object
data/lib/pdtp/common.rb CHANGED
@@ -22,7 +22,7 @@
22
22
 
23
23
  # Namespace for all PDTP components
24
24
  module PDTP
25
- PDTP::VERSION = '0.3.0' unless defined? PDTP::VERSION
25
+ PDTP::VERSION = '0.3.1' unless defined? PDTP::VERSION
26
26
  def self.version() VERSION end
27
27
 
28
28
  PDTP::DEFAULT_PORT = 6086 unless defined? PDTP::DEFAULT_PORT
data/lib/pdtp/server.rb CHANGED
@@ -51,7 +51,7 @@ module PDTP
51
51
  # Run a web server to display statistics on the given address and port
52
52
  def enable_status_page(path = '/status')
53
53
  log "status at http://#{@addr}:#{@http_port}#{path}"
54
- http_server.register path, StatusHandler.new(@dispatcher)
54
+ http_server.register path, StatusHandler.new(@dispatcher), true
55
55
  end
56
56
 
57
57
  # Serve files from the given directory
metadata CHANGED
@@ -3,7 +3,7 @@ rubygems_version: 0.9.4
3
3
  specification_version: 1
4
4
  name: distribustream
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.3.0
6
+ version: 0.3.1
7
7
  date: 2008-11-09 00:00:00 -07:00
8
8
  summary: DistribuStream is a fully open peercasting system allowing on-demand or live streaming media to be delivered at a fraction of the normal cost
9
9
  require_paths: