Commit Graph

61 Commits

Author SHA1 Message Date
Derek Collison
76de921f65 Cleanup for Auth 2017-04-20 12:41:48 -07:00
Colin Sullivan
31dc3a7e11 Increase the client dial timeout.
* Windows and stressed machines require more time to connect; this was causing flappers.
2017-01-06 15:35:41 -07:00
Ivan Kozlovic
5f471b6e7f Replace GetListenEndpoint() with ReadyForConnections()
The RunServer() function (and the various variants)
call Server.Start() in a go-routine, but do not return until
it has verified that the server is ready to accept connections.
To do so, it use GetListenEndpoint() to get a suitable connect
address (replacing "0.0.0.0" or "::" with localhost - important
on Windows). It then creates a raw TCP connection to ensure the
server is started, repeating the process in case of failure up
to 10 seconds.

This PR replaces this with a function that checks that client
listener, and route listener if configured, are set. This removes
the need to get a connect address and create test tcp connections.

The reason for this change is that NATS Streaming when starting
the NATS Server (unless configured to connect to a remote one)
calls RunServerWithAuth(), which when getting "localhost" from
GetListenEndpoint(), would fail trying to resolve it. This happened
for the NATS Streaming Docker image built with Go 1.7+.
2016-12-09 14:03:45 -07:00
Derek Collison
8fbacaaea1 Cleanup for cluster opts 2016-12-02 14:29:22 -08:00
Ivan Kozlovic
fda5bd7ac7 [ADDED] Server sends INFO with cluster URLs to clients with support
Clients that will be at the ClientProtoInfo protocol level (or above)
will now receive an asynchronous INFO protocol when the server
they connect to adds a *new* route. This means that when the cluster
adds a new server, all clients in the cluster should now be notified
of this new addition.
2016-07-26 10:55:55 -06:00
Derek Collison
e3b5713ab9 Check for control line violations and memory attacks 2016-07-11 12:03:49 -07:00
Derek Collison
46a9e6f0bc First pass at multi-user support 2016-05-13 12:27:57 -07:00
Ivan Kozlovic
ad1198db85 Add code coverage
-Test coverage was no longer triggered due to the check for BUILD_GOOS
 environment variable that was removed. Removed the check.
-Re-run test package with server code coverage.
-Remove unused functions in test.go.
-Add test for a function in test.go.
-Add missing parse +OK test.
2016-04-22 13:03:04 -06:00
Derek Collison
3e2c3714bc Fix race in interest propogation to new routes 2016-04-15 13:16:13 -07:00
Derek Collison
a4c46694ff gosimple fixes 2016-03-31 07:33:36 -07:00
Colin Sullivan
2baac47820 Address issues found by golint.
* No functional changes
* Did not address the ALL_CAPS issues
* Did not modify public APIs and field names.
2016-03-15 15:21:13 -06:00
Derek Collison
7237972420 support for bcrypt in cluster auth 2016-02-23 12:47:46 -08:00
Derek Collison
a8f622269b For possible slow travis tests 2016-02-06 07:35:09 -08:00
Ivan Kozlovic
eb0eabff04 Replace all changes with simple 25ms delay after connection close. 2016-02-03 18:58:42 -07:00
Ivan Kozlovic
437458e13e Fix completeConnection + fix monitor test.
Don't check what is sent back. The point is that the client should be fully initialized at this point.
We can't ensure using metrics that the "check" connection is gone since in some tests, the server is started and clients auto-reconnect to it.
For tests that depend on the number of clients connected (such as the monitor one), have specific code for those tests.
2016-02-03 18:08:52 -07:00
Ivan Kozlovic
0a4da78f38 Fix code that checks that server is started + route test
- The raw connection used to check that the server is started now consumes the INFO and sends PING and consumes PONG before returning.
- The route test needs to make sure that the client connection has client id 2. Using PING/PONG before creating route connection to make sure of that.
2016-02-03 15:01:00 -07:00
Derek Collison
e9b5839bf0 Merge branch 'discovery' 2015-12-16 14:18:34 -08:00
Derek Collison
8393c3c994 Basic INFO for cluster auto-discovery, Addresses #126 2015-12-16 12:36:24 -08:00
Ivan Kozlovic
d133e68338 Adapt tests for Travis GCE.
* Add server.GetListenEndpoint() to return options' host and port when server is ready to accept client connections. The server can be asked to pick a random port. This function returns a string of the form "host:port" with the port selected by the net.Listen() call.
* Replace the use of server.Addr() with above function to connect to the starting server (using net.Dial) to check for success. The original issue was that, when no hostname is specified in the configuration, the server uses 0.0.0.0 for the listen address. However, server.Addr() would return "[::]", even on a machine with IPv6 disabled, which would cause the net.Dial call to fail with "network unreachable".
2015-12-10 13:06:18 -07:00
Ivan Kozlovic
9b25a379b8 Increase TLS timeout in config files
We would get failures on Travis, I would think because of small TLS timeout. Increase (or set) the TLS timeout to 2 seconds in most configuration files. Update tests that relied on the original value.
2015-12-08 15:20:20 -07:00
Derek Collison
749d4f89cc First pass at client TLS support 2015-10-22 03:30:27 +02:00
Derek Collison
fe3b8f2aa1 BufSize option, bump for go1.5.1, bump version 2015-09-18 07:41:33 -07:00
Derek Collison
45564dbde2 race fixes, go1.5 on travis 2015-09-17 19:02:00 -07:00
Derek Collison
075529e2fe Properly handle and enforce max payload 2015-08-05 22:05:58 -07:00
Derek Collison
96bab33075 fixed import paths 2015-06-19 12:08:11 -07:00
Derek Collison
d9c7392c4d race fixes, tests 2015-06-16 12:48:50 -07:00
Máximo Cuadros Ortiz
65ae9c16f2 extendable auth methods 2014-11-27 00:26:13 +01:00
Derek Collison
65ff554574 Better split buffer testing for CONNECT, fixes issue #63. 2014-11-16 08:58:36 -08:00
Derek Collison
9dc875b88e pedantic about over zealous GC for sockets 2014-09-18 21:25:13 -07:00
Alex Toombs
20b08f5a33 Allow nats to choose a random port when given port -1.
* In order to allow nats to resolve a randomly-chosen port, we want to
  sometimes give net.Listen a port of 0. However, a port of 0 in the
  config resolve to a constant port. In order to avoid behavioral
  changes, we define '-1' to be the default "choose random port"
  number.
* Resolve ports can be retrievd using the server's Addr() method.
2014-06-05 19:48:42 -07:00
Derek Collison
e172f4bdf9 Fixed issue #29 with subscriptions leaking across routes on auto-unsubscribe 2014-04-30 14:18:42 -07:00
Derek Collison
7da1e87748 copyright hygiene 2014-02-06 19:34:12 -08:00
Derek Collison
edc49b7924 Fixes issues #21 and #22 2014-02-06 19:24:11 -08:00
Derek Collison
71c0c28ced copyright hygiene 2013-10-16 13:40:15 -07:00
Derek Collison
4e1502cc4c README license, copyright cleanup, etc 2013-09-30 10:16:43 -07:00
Derek Collison
cf0f30200f log file support, data race fixes 2013-08-02 16:52:54 -07:00
Derek Collison
f27deeabee Added official start method 2013-07-30 19:23:26 -07:00
Derek Collison
bca2ccd7d3 Release route connect Go routines on shutdown 2013-07-30 11:19:33 -07:00
Derek Collison
4e2ee9425d Send local subs, tests cleanups 2013-07-30 09:52:46 -07:00
Derek Collison
b136f41fdb Queue Subscriber rework 2013-07-29 22:33:16 -07:00
Derek Collison
d099467d2a Multiple routes w/ same Id 2013-07-29 20:15:55 -07:00
Derek Collison
de469cada6 Reconnect logic 2013-07-29 20:02:47 -07:00
Derek Collison
c61412a862 Only send over route once 2013-07-29 18:13:32 -07:00
Derek Collison
025b63300b 1-hop semantics for messages from routes 2013-07-29 17:09:41 -07:00
Derek Collison
ec4a46c959 MSG proto processing 2013-07-29 15:48:07 -07:00
Derek Collison
dd99fd12ab First pass soliciting routes with auth 2013-07-28 09:33:13 -07:00
Derek Collison
72b68bf363 Added sub and unsub broadcast to routes 2013-07-27 22:05:15 -07:00
Derek Collison
5189dba7b6 Cluster startup 2013-07-27 16:29:25 -07:00
Derek Collison
ec391c9f86 Suppress logs in default test server 2013-07-17 08:07:48 -05:00
Derek Collison
e3965bcfcc Export running a test Go routine server 2013-07-17 08:04:09 -05:00