Commit Graph

12 Commits

Author SHA1 Message Date
Sarah Jamie Lewis e382c8eb69 Rename 2018-06-08 15:05:22 -07:00
Sarah Jamie Lewis 05e8675ed5 Fixing a few golint issues 2018-01-05 14:16:52 -08:00
Sarah Jamie Lewis f537fb4f76 Adding Simple Application Broadcast & Features Enabled 2018-01-01 10:06:58 -08:00
Sarah Jamie Lewis 1433b31e6f Change inbound/outbound handlers to use Identity.
Add Inbound Version Negotiation Test
2017-12-13 11:42:54 -08:00
Sarah Jamie Lewis 43b357fdb6 First cut of minimizing private_key exposure in the code base
Minor formatting
2017-12-05 11:00:04 -08:00
John Brooks b2c87b1b72 Fix concurrency issues in ProcessAuthAsClient/Server
There were a few related issues with ProcessAuthAsClient/Server that
could cause deadlocks or leak goroutines:

Break() could end up being called more than once, which is always a
deadlock. This is fixed by using a sync.Once.

RequestOpenChannel was called without Do, and was called before
Process in the same goroutine, which would have deadlocked if Do was
used.

Timing out the authentication attempt wouldn't directly abort
Process(); it would only exit if the connection was closed somewhere
else.

It may be a good idea to change some of this to guarantee that
ProcessAuthAsClient returns either an authenticated connection or closes
the connection, but I'll leave that as a separate task for the moment.
2017-11-02 15:41:35 -07:00
John Brooks 0f47f62465 Return the new channel from RequestOpenChannel
This fixes a quirk where it would've been difficult to tell which of
several channels of the same type+direction is the one you just created.

It's also a fairly common pattern to want to interact with a channel
right after opening it; for example, a chat channel is opened and can
immediately send messages before getting the peer response. It's
convenient to not have to do a separate lookup.
2017-11-02 15:40:02 -07:00
John Brooks d19102b257 Pass channel handler directly to RequestOpenChannel
RequestOpenChannel is the primary API to open a new outbound channel. It
was written to take a connection.Handler and use OnOpenChannelRequest
to get a channels.Handler to represent the new channel, which is the
same path that inbound channels will take.

Going through the global OnOpenChannelRequest method makes this much
less flexible and prevents passing parameters to the new channel handler
during creation.  This also requires users of the API to know/find the
connection handler, or worse, to boilerplate one into existence for their
channel creation.

Instead, I think this function should take a channels.Handler directly,
so that the caller gets full control over the handler for their new
channel.

As part of that change, I've also moved the authentication logic in
AutoConnectionHandler to be contained entirely within
{In,Out}boundConnectionHandler.
2017-11-02 15:40:02 -07:00
Sarah Jamie Lewis 22cbf5d738 First Cut of Applications + Bugs, Formatting 2017-07-04 11:29:11 -07:00
Sarah Jamie Lewis 1cf7c2b7c7 Adding a Trace log to Connection and removing all other logging directives 2017-06-27 12:48:35 -07:00
Sarah Jamie Lewis f4ed1c244b Adding Inbound Version Negotiation
+ Error handling for missing private key setting
2017-06-27 10:39:33 -07:00
Sarah Jamie Lewis 5d767174b1 Brand new API v0.2 2017-05-02 16:33:51 -07:00