[Aversa-commits] aversa/lib/net/bittorrent ChangeLog metainfo.rb
peerwireprotocol.rb storage.rb tracker.rb
teamikl at dsl092-150-242.wdc2.dsl.speakeasy.net
teamikl at dsl092-150-242.wdc2.dsl.speakeasy.net
Tue Nov 2 04:38:05 EST 2004
Update of /var/cvs/aversa/aversa/lib/net/bittorrent
In directory rubyforge.org:/tmp/cvs-serv7216/lib/net/bittorrent
Modified Files:
ChangeLog metainfo.rb peerwireprotocol.rb storage.rb
tracker.rb
Log Message:
Added code to handle multi files metainfo.
Index: metainfo.rb
===================================================================
RCS file: /var/cvs/aversa/aversa/lib/net/bittorrent/metainfo.rb,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** metainfo.rb 20 Sep 2004 03:11:46 -0000 1.8
--- metainfo.rb 2 Nov 2004 09:37:59 -0000 1.9
***************
*** 108,112 ****
file['length'] = FileTest.size(name)
info['files'].push(file)
- p file
end
# TODO use Find#find to search directory tree.
--- 108,111 ----
Index: peerwireprotocol.rb
===================================================================
RCS file: /var/cvs/aversa/aversa/lib/net/bittorrent/peerwireprotocol.rb,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** peerwireprotocol.rb 13 Sep 2004 17:33:39 -0000 1.2
--- peerwireprotocol.rb 2 Nov 2004 09:37:59 -0000 1.3
***************
*** 1,5 ****
--- 1,15 ----
##
# == NAME
+ #
+ # Net::BitTorrent::PeerWireProtocol class
+ #
+ # == DESCRIPTION
+ #
+ # The PeerWireProtocol class will provide send/recv packed messages
+ # for socket IO.
#
+ # == NOTES
+ #
+ # Should do it with Mix-in ?
#
# == AUTHORS
***************
*** 107,114 ****
# <peer_id> : 20 bytes
#
! # YouArentGonnaNeedIt:
! # I do hard-coding protocol name and reserved data.
! # I do not write the code for those extends, right now.
! # I may change the interface of this method when Spec is updated.
def handshake(info_hash, peer_id="")
protocol = [19].pack("C") + "BitTorrent protocol"
--- 117,121 ----
# <peer_id> : 20 bytes
#
! # - TODO the protocol name is a consts, move it.
def handshake(info_hash, peer_id="")
protocol = [19].pack("C") + "BitTorrent protocol"
Index: tracker.rb
===================================================================
RCS file: /var/cvs/aversa/aversa/lib/net/bittorrent/tracker.rb,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** tracker.rb 27 Sep 2004 07:19:43 -0000 1.6
--- tracker.rb 2 Nov 2004 09:37:59 -0000 1.7
***************
*** 1,12 ****
! # === NAME
#
# BitTorrent Tracker module.
#
! # === EXAMPLES
#
# - TODO write examples for Tracker.
# see ./test/net-bittorrent/tc_tracker.rb and ./lib/aversa/track.rb for now.
#
! # === NOTES
#
# Tracker's Request/Response should extends HTTP's Request/Response class.
--- 1,12 ----
! # == NAME
#
# BitTorrent Tracker module.
#
! # == EXAMPLES
#
# - TODO write examples for Tracker.
# see ./test/net-bittorrent/tc_tracker.rb and ./lib/aversa/track.rb for now.
#
! # == NOTES
#
# Tracker's Request/Response should extends HTTP's Request/Response class.
Index: storage.rb
===================================================================
RCS file: /var/cvs/aversa/aversa/lib/net/bittorrent/storage.rb,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** storage.rb 24 Sep 2004 15:53:32 -0000 1.5
--- storage.rb 2 Nov 2004 09:37:59 -0000 1.6
***************
*** 60,63 ****
--- 60,64 ----
# prepare @files
+ # TODO tidy me
if @metainfo['info'].key? 'files'
@files = @metainfo['info']['files'].map{|file|
***************
*** 66,79 ****
}
else
! @files = [{ 'path' => @metainfo['info']['name'],
'length' => @metainfo['info']['length'] }]
end
-
- # Touch files unless file exists
- #
- # @files.each do |file|
- # open(file['path'],'w').close unless File.exists? file['path']
- # end
-
end
--- 67,73 ----
}
else
! @files = [{ 'path' => @metainfo['info']['name'],
'length' => @metainfo['info']['length'] }]
end
end
***************
*** 128,133 ****
def length
@files.inject(0) do |len, file|
! # path = File.join(@path, file['path'])
! file_path = file['path']
len += (File.exists? file_path) ? FileTest.size(file_path) : 0
end
--- 122,126 ----
def length
@files.inject(0) do |len, file|
! file_path = File.join(@path, file['path'])
len += (File.exists? file_path) ? FileTest.size(file_path) : 0
end
***************
*** 182,187 ****
#
def get_filehandle(file_name)
! # file_path = File.join(@path, file_name)
! file_path = file_name
unless @handles.has_key? file_name
--- 175,179 ----
#
def get_filehandle(file_name)
! file_path = File.join(@path, file_name)
unless @handles.has_key? file_name
***************
*** 192,198 ****
end
! return @handles[file_name]
end
-
end
end
--- 184,189 ----
end
! @handles[file_name]
end
end
end
Index: ChangeLog
===================================================================
RCS file: /var/cvs/aversa/aversa/lib/net/bittorrent/ChangeLog,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** ChangeLog 16 Sep 2004 14:36:27 -0000 1.3
--- ChangeLog 2 Nov 2004 09:37:59 -0000 1.4
***************
*** 1,4 ****
--- 1,8 ----
# vim: noexpandtab tabstop=8 shiftwidth=8
+ 2004-11-01 Ikkei Shimomura <tea at kcn.ne.jp>
+ * Tidy documents.
+ * Fixed path problem of Storage class.
+
2004-09-16 Ikkei Shimomura <tea at kcn.ne.jp>
* Added pack/unpack ip address and port.
More information about the Aversa-commits
mailing list