Ecosyste.ms: OpenCollective

An open API service for software projects hosted on Open Collective.

github.com/alanmcgovern/monotorrent

The official repository for MonoTorrent, a bittorrent library for .NET
https://github.com/alanmcgovern/monotorrent

[tests] Make these tests more robust across different OS's

All we really care about is that the task returned by
'SendAsync' or 'ReceiveAsync' does not blo...

cef2ec2ab1ef08754b907df4f9833528ce1ee15d authored about 5 years ago by Alan McGovern <[email protected]>
[tests] Make this test threadsafe

The event is async so we should not rely on it executing before
the Announce task completes.

13605d1dfae275c3f869548cc314d9bb451bc2de authored about 5 years ago by Alan McGovern <[email protected]>
[core] Allow compiling with langversion=7.0

8ad5efa7b230fb2b07b05b8834f923ff2092ea88 authored about 5 years ago by Alan McGovern <[email protected]>
[core] Move UdpListener to async too

Standard CancellationToken semantics!

fabe06f07852c94fb90794c78f59b1e4d5956f4d authored about 5 years ago by Alan McGovern <[email protected]>
[core] Simplify LocalPeerListener

It's concern is purely to receive broadcast messages and then
pass the data to the ClientEngine ...

6a52596a1ca67d97776ad586c2cc12d400206d4c authored about 5 years ago by Alan McGovern <[email protected]>
[core] If the state is PortNotFree we should allow changing

1782df3e6f6cb69e68e17df8a76e06c51c42f335 authored about 5 years ago by Alan McGovern <[email protected]>
[core] Split TrackerManager away from ClientEngine/TorrentManager

The TrackerManager just needs a way to generate the appropriate
AnnounceParameters or ScrapePara...

5c5ca1109c23cbf24f1a467b9ef9bd2bf6e85c6d authored about 5 years ago by Alan McGovern <[email protected]>
[core] Cleanups for TrackerManager

Use Stopwatch instead of DateTime.[Utc]Now. Fix up some comments
to make them a bit more accurat...

a36291a67bfc8595b354e508d83d8d94377f9c38 authored about 5 years ago by Alan McGovern <[email protected]>
[core] Ensure user-initiated Announces/Scrapes are threaded correctly

These should be proxied to the main loop.

710c02edd455ab43ebaf53d2002fe0a5af7d6961 authored about 5 years ago by Alan McGovern <[email protected]>
[tests] Add some more tracker tests

Just covering a few more cases.

59fd92bd7c7a5cef8cb4db88f28a331a986337f7 authored about 5 years ago by Alan McGovern <[email protected]>
[tests] Add a test for Scrapes throwing exceptions.

This also fixes two bugs :) Firstly, it is allowed to set
'Tracker' to null when all Trackers fa...

f9637dca6644712c5f4b2e6821758542523fe54e authored about 5 years ago by Alan McGovern <[email protected]>
[core] Remove extra variable storing the InfoHash

ad268f075e8c1183d15646580bc9a3f964c27779 authored about 5 years ago by Alan McGovern <[email protected]>
[tests] Move more tests to async instead of blocking

Allows me to remove the old BeginSend/Receive methods.

f523c691211a06bca583fc2ccc5c0a222955f159 authored about 5 years ago by Alan McGovern <[email protected]>
[sample] Remove a dead file

44b61caf1bee55541fd1f36760f90286bb9d06f5 authored about 5 years ago by Alan McGovern <[email protected]>
[tests] Prevent a deadlock in the tests

If we need to await a Task we should have a timeout in case it
never actually completes.

79ac72777fcdbe5356bd8e6e5dda6d81b2d9b081 authored about 5 years ago by Alan McGovern <[email protected]>
[core] Put the announce/scrape events on TrackerManager

This is easier than having to iterate over every Tracker and
attaching to individual events. As ...

a55a309b970de00ac12e45ed24f37625bac30eb3 authored about 5 years ago by Alan McGovern <[email protected]>
[core] Simplify the logic used to announce to tracker tiers

The async/await changes make this a little easier to represent
using normal/sequential logic.

664729fd6fd42e5c5d72defdf191dde1441d5446 authored about 5 years ago by Alan McGovern <[email protected]>
[core] Clean up some public->internal in the trackers

Also swap to autoprops in some places.

d3efaf41fb3f07a2455091ba053b545f98878f8c authored about 5 years ago by Alan McGovern <[email protected]>
[core] Move TrackerFactory to use a Func instead of Activator

876ec2acbaf46d047e487321cedf3340a9b5ce44 authored about 5 years ago by Alan McGovern <[email protected]>
[core] Make AnnounceParameters and ScrapeParameters immutable

9b19e7d30478fd65c77785ccf5b5564772250a24 authored about 5 years ago by Alan McGovern <[email protected]>
[core] Make SpeedMonitor use a Stopwatch

39b2d18cfd1e429976ca2dd785242fb288a2017a authored about 5 years ago by Alan McGovern <[email protected]>
[core] Clean up async creation for TorrentCreator

The Async variants offer the same overloads as the synchronous
variants, and all the Async varia...

2495607967180f20748e4ef10f77f7f41d1f38c9 authored about 5 years ago by Alan McGovern <[email protected]>
[core] Redo BufferManager a little

The simplifications we gained from async/await across the
codebase mean we no longer have confus...

9d6d4d80760c35258ae81638530aa1cd287a368e authored about 5 years ago by Alan McGovern <[email protected]>
[core] Make a few more things internal

We don't particularly want people mutating our objects
while we're using them, so hide the metho...

bf5dcacd6db309d156f79bd9a39874e3a5709926 authored about 5 years ago by Alan McGovern <[email protected]>
[core] Remove two unused classes

3ddcf2a79c2118a3af66ef2613b9022e4913a405 authored about 5 years ago by Alan McGovern <[email protected]>
[core] The SpeedMonitors should be internal

These are not supposed to be exposed to the public. They
are controlled exclusively by the engin...

4fa4269c2c8280dec5a14528c540ef4b13d6c048 authored about 5 years ago by Alan McGovern <[email protected]>
[core] Peer.Encryption should have an internal setter

This isn't for people to mess with. The engine manages this
value based on whether or not an enc...

2c6f4cf81267445b4f0ff3fb650a3d7d42fc5bfd authored about 5 years ago by Alan McGovern <[email protected]>
[core] Make these types internal/sealed

They're not user-extendable/usable.

e49b7379f296a0cf5044143960e469d687ecba46 authored about 5 years ago by Alan McGovern <[email protected]>
[core] Allow the TCS to be GC'ed

ca595840d3859a1fd411db366018c460a83c91db authored about 5 years ago by Alan McGovern <[email protected]>
[core] Cache reusable SocketAsyncEventArgs objects

This way we can associate an eventargs with each buffer from
our BufferManager and re-use that e...

9a25e4bf23f12b073e2ecfe6b9c7119b0da54569 authored about 5 years ago by Alan McGovern <[email protected]>
[core] Small tweak after commit 3d54e0c7

Now that we're null out the Socket object we need to be careful
to null check the socket to avoi...

dae0b2274f68b4cc780235b4c36a63449af2e7f5 authored about 5 years ago by Alan McGovern <[email protected]>
[core] Ensure the last message sent/received timers are running

If we never send or receive any messages, we do want our timeout
to be hit. That means we need t...

fbdbf26ead502e953b70b78093b5639c961a50ba authored about 5 years ago by Alan McGovern <[email protected]>
[core] Don't rely on Activator.CreateInstance

There are better ways :p

5e9fd5e0e145c593147e8c02bae68d8e28c8a44f authored about 5 years ago by Alan McGovern <[email protected]>
[core] Add a way to calculate the number of blocks received

Rather than exporting a clone of the active request list and
then iterating it to see how many o...

6ae1787b533c3e13b867d568970f8c059a2a6280 authored about 5 years ago by Alan McGovern <[email protected]>
[core] Instantiate fewer HaveMessage objects

We can instantiate the HaveMessage once and send it to many peers.

a173881feebc4abf7d85b2645dc3f6f6996c972e authored about 5 years ago by Alan McGovern <[email protected]>
[core] Don't instantiate BlockEventArgs if it'll never be used

88c38934b1b1f1ad63911852e9f4c8e5feca6836 authored about 5 years ago by Alan McGovern <[email protected]>
[core] Ensure we always free the buffer if we allocate it

If either the DiskManager or SendMessageAsync methods throw
an exception we should still return ...

5f44522113dd4fe23a5851d69bb2dc7f5b2c07ed authored about 5 years ago by Alan McGovern <[email protected]>
[core] Ensure we process the queue if we call EnqueueAt

If we call 'Enqueue' we automatically kick off the messaging
sending logic to begin sending mess...

d16c515b47fdc1305af91ef3f061a1fc4a9673ff authored about 5 years ago by Alan McGovern <[email protected]>
[core] Use the already-allocated TaskCompletionSource

Since we've already instantiated a TaskCompletionSource we
should go ahead and populate it inste...

6d629dc6bf8dcf9df113dc7f2fdb35769e624a11 authored about 5 years ago by Alan McGovern <[email protected]>
[core] Don't box millions of BinaryIndexComparers

We can just cache and reuse them. Saves a few dozen MB of
allocations for a small torrent.

21a7d8a52197cf44c9abc5800b2bf0d619432994 authored about 5 years ago by Alan McGovern <[email protected]>
[core] Run PeerExchangeManager without using a timed callback

If we have a timer callback which executes every 1 minute, then
the objects referred to by that ...

04ce607af697771f35378521be9e5274156d75df authored about 5 years ago by Alan McGovern <[email protected]>
[core] Populate the EndGamePicker correctly

When doing the initial population of pending requests we should
not add items for blocks which h...

0ab5ad4b41372408207d350a9049657c5c9eb71e authored about 5 years ago by Alan McGovern <[email protected]>
[core] Rewrite EndGamePicker to be a little neater

6bbfd7e5209f94de99a896789a141905859e45e0 authored about 5 years ago by Alan McGovern <[email protected]>
[core] Ensure we process every PeerId when switching to Seeding mode

If we're swapping from downloading -> seeding we dispose every
connection where we know the othe...

770036b57b4c352037947b362a950931b51f70d8 authored about 5 years ago by Alan McGovern <[email protected]>
[core] When we switch to EndGame mode we should clear the Standard picker

This prevents it from retaining requests forever.

Partial fix for https://github.com/mono/monot...

7f82dbe57f657a9b816313d89e2a1ad550b95e8d authored about 5 years ago by Alan McGovern <[email protected]>
[core] Cache the delegate object so it can be reused

This is a little better memory-wise.

97add39f07c7d7171e9e268b42a0bfcf35d79362 authored about 5 years ago by Alan McGovern <[email protected]>
[core] bug fixed--memory leaking caused by SocketAsyncEventArgs

Small tweaks applied by Alan before commiting.

3d54e0c79f0d9d33c63acc44044c8806e29e300a authored about 5 years ago by OneFingerCodingWarrior <[email protected]>
[core] Add tests for SocketConnection cancellation/disposing

2c10b9c39f238ab42994c5155ce75b3156f00163 authored about 5 years ago by Alan McGovern <[email protected]>
[core] Dispose the SHA1 hash object when we're done

4810a70b430e549898a233c7fd0ac0577910c0c5 authored about 5 years ago by Alan McGovern <[email protected]>
[core] Ensure ActivePeers and ConnectedPeers remain in sync

Always add/remove from these two lists at the same time to ensure
they are always in sync.

As p...

6782251216b175bed656701a0cdaa81f0a464bd3 authored about 5 years ago by Alan McGovern <[email protected]>
[core] Add 'SafeDispose' which wraps Dispose in a try/catch

We can't guarantee that user subclasses of things like IConnection
won't throw exceptions, so le...

0dab4e3d36a2fe989abd72133aff0a49a482c2f2 authored about 5 years ago by Alan McGovern <[email protected]>
[core] Move the Dispose call to the end of the method

That way we can complete all our cleanup before disposing the
object.

Patch modified from chang...

0e34c96dc2538c080930c0792647692283eb8064 authored about 5 years ago by Alan McGovern <[email protected]>
[dht] Just use a stopwatch directly for timeouting

If we want to time out a message early, we just set Engine.Timeout
to be Zero. We don't need to ...

6ae7c1cef9bdae08c58798b275eb4b271b05c8d3 authored about 5 years ago by Alan McGovern <[email protected]>
[dht] Remove some stopwatching we don't need in MessageLoop

We just care that we send 5 messages every loop. We don't need
additional checks to rate limit.

9fcdeed72b9b950f415ecff622b7519253b93b73 authored about 5 years ago by Alan McGovern <[email protected]>
[dht] Move timekeeping out of TokenManager

This class is quite simple to unit test as it no longer
relies on any timing. The DhtEngine is r...

43b98ba909fadccdb15b1be89bbed2c9fd73e81f authored about 5 years ago by Alan McGovern <[email protected]>
[dht] Move MessageLoop to use a Stopwatch instead of DateTime

b96ea43a2442b9cc8c2fb5aa120adbfe226581b5 authored about 5 years ago by Alan McGovern <[email protected]>
[dht] Use Stopwatch for Bucket.LastChanged too

Same reasoning as last time.

77ae42902b24aa77a2c662228c67c5c38d6e0074 authored about 5 years ago by Alan McGovern <[email protected]>
[dht] Add some tests around Bucket.SortBySeen

Also use stopwatch instead of DateTime for calculating
deltas. Stopwatch timestamps are much che...

b9b3336f9193958aa7bf4566a7a1ddeea0299bb8 authored about 5 years ago by Alan McGovern <[email protected]>
[dht] Clean up Message a little

30df5caa197d1c0f72932e850ecf4137737f81ff authored about 5 years ago by Alan McGovern <[email protected]>
[dht] Move to auto props instead of fields+props

ffc43f92122e474c96521ef800baa29f2c842b1b authored about 5 years ago by Alan McGovern <[email protected]>
[dht] Call 'Seen' instead of updating LastSeen

If we call Seen then the FailedCount is set to zero, which is
the correct thing to do as this su...

4b84e36012191e288e61c5d32793b91bd146c93c authored about 5 years ago by Alan McGovern <[email protected]>
[dht] Remove the 'Xor' method as we have the normal operator

6d7daa3569f742634908becede1dce4f8e1b3793 authored about 5 years ago by Alan McGovern <[email protected]>
[dht] Clean up how the response for a Query is created

Use a normal abstract method to implement this feature, and
remove the reference to the 'Query' ...

9bfb9609d8467d28f26e17f02d3b85bf3effe36e authored about 5 years ago by Alan McGovern <[email protected]>
[dht] Misc code cleanups

Make stuff readonly.
Remove unused 'using' statements.
Add some license headers.

f1da01e262f246748ff0a28ec3296198c1f0efdf authored about 5 years ago by Alan McGovern <[email protected]>
[BEncoding] Add a GetValueOrDefault implementation

Slims up some code and makes it easier to probe for values.

777dec402200ec5d1ffd4590d8436870afd838f8 authored about 5 years ago by Alan McGovern <[email protected]>
[dht] Generate unique TransactionIds without a lock

We can just increment an integer using the Interlocked class
and take the first two bytes of the...

8c4558fabff71962ee268a696ce63132a6b00d59 authored about 5 years ago by Alan McGovern <[email protected]>
[dht] Don't make nodes IComparable

They need to be compared in different ways at different places in
the codebase, so it's safer to...

943edbfa402fd692c78ecb99619531b17acaf356 authored about 5 years ago by Alan McGovern <[email protected]>
[dht] ClosestNodesCollection should use ValueTuple, not Tuple

Less memory overhead.

a1346dca9303345779fef63b1cb348c473e94faf authored about 5 years ago by Alan McGovern <[email protected]>
[dht] Fix ClosestNodesCollection.Contains

2115246dc43a22a832452ea5a222b55a93a32249 authored about 5 years ago by Alan McGovern <[email protected]>
Merge pull request #98 from mono/dht-updates

Dht updates

2b04ae0c6d2bee555d2d2f4f769f90d89327b261 authored about 5 years ago by Alan McGovern <[email protected]>
[dht] Don't throw an exception when Nodes is missing

According to the spec a FindNodeResponse should contain a
'nodes' key, but some implementations ...

17b7db410262b3cf6b47047f335717239c587017 authored about 5 years ago by Alan McGovern <[email protected]>
[dht] Treat the Token as a BEncodedValue

Technically this does not have to be a BEncodedString, so
let's accept any BEncodedValue from ot...

33a62b89e35274124fbf7a7c1a803a9be08fec2e authored about 5 years ago by Alan McGovern <[email protected]>
[dht] Error gracefully when malformed responses are received

If the received dictionary doesn't have a message type identifier
then we should bail out immedi...

c41864542d3505d887feaabffe57a3af0fd72713 authored about 5 years ago by Alan McGovern <[email protected]>
[core] Add BEncodedString.Empty

Because why not!

6bb3bace14249d05fa4308982a351fbbc06f0106 authored about 5 years ago by Alan McGovern <[email protected]>
[dht] GetPeers should keep track of active nodes only

When we search for peers, we should keep track of the nodes
which responded to us. This way when...

e00d55a603a221257a083fe68fe491cf4584d31e authored about 5 years ago by Alan McGovern <[email protected]>
[dht] Move the closest node logic to it's own Collection implementation

This is a little simpler to deal with! It has the same semantics as
a HashSet - if a closer node...

58e200f1775cb773114405521231186c30db3370 authored about 5 years ago by Alan McGovern <[email protected]>
[dht] Improve GetPeersTask to be more async

This is now written in a similar style to InitialiseTask. It
sends as many messages concurrently...

8d147d2deede101aefe91e97e44ebf8074c58606 authored about 5 years ago by Alan McGovern <[email protected]>
[dht] Send all 'AnnouncePeer' messages concurrently

We shouldn't wait for one message to time out before sending
the next announce message.

eaaa9defde48f85aef29a11aa6ec9f766ef7fe5d authored about 5 years ago by Alan McGovern <[email protected]>
[dht] Remove the synchronous Execute method from InitialiseTask

0bbd90f8546596e72a51b9d0b8bc8420fa5aef2c authored about 5 years ago by Alan McGovern <[email protected]>
[core] Clean up several build warnings

Use discard variables "_ =" to ignore returned Task objects
which we don't want to await.

16857d740d0261c2bc2539c8cacc881e8dff0faa authored about 5 years ago by Alan McGovern <[email protected]>
[dht] Change the semantics of 'IDhtEngine.StartAsync'

The returned task used to wait for the full bootstrap to complete
(if one was needed). However t...

7da5dfeb4b5148c48ec1f097dc02d54e0e90b94f authored about 5 years ago by Alan McGovern <[email protected]>
[dht] Make IDhtEngine fully async

Now we can ensure all of the Dht engine interactions can be
performed in a non-blocking but thre...

dc6ced9482686208b41231a31cfb11bc83c24b60 authored about 5 years ago by Alan McGovern <[email protected]>
[sample] Don't copy/paste main.cs for the DotNetCore sample

Just reference the existing files instead of copying/pasting.

b82fb6d7ed53838db69a3ddfe0cd3773bc854b73 authored about 5 years ago by Alan McGovern <[email protected]>
[dht] Don't store eventhandlers in the NullDhtEngine

We'll never raise events, so if anyone attaches event handlers
just discard them.

021fa24b05db570f154151bcd406df99f38b1ae1 authored about 5 years ago by Alan McGovern <[email protected]>
[core] Just set a default value to the DhtEngine property

We don't want/need to Register it, we can just set a non-null
value on the property.

5ea7a430e9b588ee8fe24b9528cedc9ec1d5e849 authored about 5 years ago by Alan McGovern <[email protected]>
[build] Commit this so an external console is always used

9d468a19c4c9c491b8d1edb327838e59aea347fa authored about 5 years ago by Alan McGovern <[email protected]>
[dht] Ensure we handle ErrorMessages correctly

When we receive an ErrorMessage we should treat it like a
ResponseMessage - we need to unregiste...

08b6cc0649a2f82f2c68fb5da7c1fef718a92f80 authored about 5 years ago by Alan McGovern <[email protected]>
[dht] Add the ability to check remaining pending requests

The tests will use this to ensure that pending requests are
removed from the list when the respo...

1800b532985082016c2c082e9f59a452ad0b831a authored about 5 years ago by Alan McGovern <[email protected]>
[dht] Rewrite the DHT tests to not need Thread.Sleep

Timeouts are either zero, or the default value. If we rely on
a message being sent, and a respon...

f324ebcd6aa9f938d0ccb5079619f4ef11dfe779 authored about 5 years ago by Alan McGovern <[email protected]>
[dht] Immediately cancel pending messages if the timeout is zero

This is useful for tests when we want to time messages out on
purpose.

d4938f2bdb94c7fda31b44028d60807ea06c7dfd authored about 5 years ago by Alan McGovern <[email protected]>
[dht] Change how messages are queued to send

Send at most 5 messages every 5 milliseconds. This avoids the
possibility of overloading bad rou...

3da41b2b19bb0797e0d81c8e578ed098d70f0662 authored about 5 years ago by Alan McGovern <[email protected]>
[dht] Simplify the event assignment

2729c5715f33a428d7df7d4ae513253fd1083bd8 authored about 5 years ago by Alan McGovern <[email protected]>
[dht] Reduce frequency of some housecleaning tasks

The timeout is 15 minutes so there's no need to run the logic
once per second.

78ce905681e74f49a8620dbcfe356597f9a45027 authored about 5 years ago by Alan McGovern <[email protected]>
[dht] Rewrite this test to send responses properly

This test should send a PingResponse message as soon as a Ping
is sent so that the new nodes are...

df23caf13fac7634b93a6714e687486868c13367 authored about 5 years ago by Alan McGovern <[email protected]>
[dht] Let the test harness know when messages have been sent

Sometimes we'll want to respond with a Response message when a
Query is sent.

b05085e1a9eed13489650c2365c9ca0ebaeb69db authored about 5 years ago by Alan McGovern <[email protected]>
[dht] Clean up MessageLoop a bit

This is a slightly cleaner way of handling message timeouts.
It also ensures we always clean up ...

d4814cd0e39e32bbcf48e28bdc23a055abadb083 authored about 5 years ago by Alan McGovern <[email protected]>
[dht] Remove an unused field

We don't actually count the active sends, nor should we! Once
a message is sent then we wait for...

6651f66ac0c012156970d4fe9b72f3b94f2c5cf0 authored about 5 years ago by Alan McGovern <[email protected]>
[dht] Remove some unnecessary Console.WriteLines

754adf29d0502bdf48a0ab94944126641d9e9f98 authored about 5 years ago by Alan McGovern <[email protected]>
[dht] Check the TransactionId and ID to make sure they're valid

If we receive a message we should immediately ensure we have both
a transaction id and a valid I...

b9f7f69884e5aeab6cf4c2798de642dd1e22057b authored about 5 years ago by Alan McGovern <[email protected]>
[dht] Process all pending messages in one go

When doing our loop we should iterate over all available
messages and process them in one go.

e8d0468d749f9e1731f1b581ef5154ccd56e10f2 authored about 5 years ago by Alan McGovern <[email protected]>