Handbook
Glossary
<peer> ( torrent remote -- peer )
Vocabulary
bittorrent
Inputs
torrent
an
object
remote
an
object
Outputs
peer
an
object
Definition
USING:
accessors
assocs
byte-arrays
byte-vectors
calendar
io
kernel
math
math.functions
sequences
timers
;
IN:
bittorrent
::
<peer>
( torrent remote -- peer )
peer
new
torrent
>>torrent
remote
>>remote
t
>>self-choking
f
>>self-interested
t
>>peer-choking
f
>>peer-interested
dup
[
[
T{
keep-alive
}
write-message
flush
]
with-peer
]
curry
30
seconds
dup
<timer>
>>timer
torrent
metainfo>>
"info"
of
"pieces"
of
length
20
/
[
>>#pieces
]
keep
8
/
ceiling
<byte-array>
>>bitfield
torrent
metainfo>>
"info"
of
"piece length"
of
[
>>piece-length
]
keep
<byte-vector>
>>current-piece
;