Commit Graph

105 Commits

Author SHA1 Message Date
Ivan Kozlovic
6f9d542393 Minor changes based on comments 2016-07-26 12:25:33 -06: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
7730fac9e2 Authorization enforcement and performance tweaks 2016-06-16 17:07:25 -07:00
Ivan Kozlovic
7bcb699903 Add /stacksz to monitoring
Allows to get the server's stacks from the monitoring interface.
2016-05-23 14:59:09 -06:00
Derek Collison
9e73c1db76 Enable listen address parsing for client, cluster and http, enforce http hosts as separate 2016-05-12 16:47:01 -07:00
Ivan Kozlovic
3691d14426 Fix missing capture of remoteID in removeClient
This needed to be captured under the client lock. Adding a test
that captured the races (when running enough times).
2016-04-22 18:06:38 -06:00
Ivan Kozlovic
3a999c1299 Add tracking of most go routines started by the server
Refactor the way client is initialized. We need to ensure that
clients are not added to the clients map and readLoop started if
the server is in the process of being shutdown otherwise there
is a chance that the server already gathered the list of connections
to close and this one would not be included, leaving a readLoop
running.
Same occurs for routes, with the complexity that the readLoop is
started well before the route connection is added to the server
routes' list. We need a temporary map that contains those connections
to be able to close them on server Shutdown.

Fixed some flapping tests.
2016-04-21 11:48:39 -06:00
Ivan Kozlovic
3aa09ecc01 Ensure Shutdown() waits for outstanding routes go routines
We need to make sure that when Shutdown() returns, routes go routines
that try to connect or reconnect have returned. Otherwise, this may
affect tests running one after the other (a server from one test
may connect to a server in the next test).
2016-04-21 11:48:39 -06:00
Derek Collison
5bea74c2ed Rename and move some things around 2016-04-21 09:33:26 -07:00
Derek Collison
b3388db53f Enable dynamic write buffers for client connections 2016-04-15 18:16:13 -07:00
Derek Collison
df02bc0bcf Removed sublist, hash and hashmap, no longer needed. 2016-04-02 12:52:48 -07:00
Derek Collison
f23f55518c gosimple fixes 2016-03-31 07:28:40 -07:00
Derek Collison
3dd490a449 Go Report Card fixes 2016-03-20 16:06:28 -10:00
Derek Collison
50a14ac1d5 Modified debug and server id 2016-03-20 15:57:43 -10: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
Ivan Kozlovic
6263c66a40 Fixed code and tests to run on Windows
Mainly tests, but also a fix in route.go to reject a route when the
server is being shutdown.
2016-03-07 18:47:20 -07:00
Ivan Kozlovic
7c0a3b49a6 Fix cluster formation when servers connect quickly
Both seed and chained cases are now handled properly when servers
connect quickly and concurrently to one another.
When accepting a route, the server will forward the new route INFO
protocol to its known routes. In turn those routes will connect
to the new server (if not already connected).
A retry for implicit route was introduced to mitigate the issue
with two servers connecting to each other and electing the opposite
connection as the winner, resulting in both connections being dropped.
The server with smaller ID will try once to reconnect.
Some tests were fixed to handle possible extra INFO protocol.
New tests added.

Fix issue: https://github.com/nats-io/gnatsd/issues/206
2016-02-24 19:44:25 -07:00
Derek Collison
b34d6eac1e ID prefix, print debug server ID on startup, bumped version 2016-02-24 09:38:28 -08:00
Derek Collison
7237972420 support for bcrypt in cluster auth 2016-02-23 12:47:46 -08:00
Ivan Kozlovic
945fb0997a Fix missing return after Fatalf() calls.
Due to clash on monitor ports, running parallel tests could cause failure to create monitor listener. The missing return would then cause a nil pointer error when starting to server http requests.
2016-02-08 09:30:44 -07:00
Ivan Kozlovic
1d6dafc6a7 Fix race on connz monitor (issue #189) 2016-02-03 21:26:26 -07:00
Derek Collison
3af90e454f Track total connections, http request stats 2016-01-09 09:57:04 -08:00
Derek Collison
b0c22e9dfd Track start and uptime per connection 2016-01-09 08:20:24 -08: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
b060eb3d5f Ensure server lock is released in case of failure when resolving port back to options. 2015-12-10 14:11:37 -07: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
5036bbbf36 Fix TLS issue where server started to receive TLS data on non TLS connection.
Without the server fix, tls_test.go would likely report an error. The server would show a parser error with protocol snippet containing "random" bytes, likely encrypted data.
2015-12-07 19:44:12 -07:00
Derek Collison
0b22a145d8 no cert for https monitoring, use JoinHostPort 2015-12-03 15:37:26 -08:00
Derek Collison
b61da04ef7 Enable HTTPS for monitoring 2015-12-01 19:01:56 -08:00
Derek Collison
647213b1d7 TLS timeout handling for routes 2015-11-22 15:07:44 -08:00
Derek Collison
3b64567f00 tls flags, proper timeouts 2015-11-22 14:43:16 -08:00
Derek Collison
1c7f708217 Added in support for requiring client certificates 2015-11-08 10:48:39 -08: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
afc1bb05b1 Added root handler, collapsed subscriptionsz 2015-08-06 00:58:24 -07:00
Derek Collison
075529e2fe Properly handle and enforce max payload 2015-08-05 22:05:58 -07:00
Derek Collison
4dd23e0f2d Added slow consumers to varz, fixed reporting bug 2015-07-14 14:55:36 -07:00
Derek Collison
de8fa5d104 Add go version to info block 2015-07-14 14:12:56 -07:00
Derek Collison
96bab33075 fixed import paths 2015-06-19 12:08:11 -07:00
Derek Collison
13150730c4 Added /routez 2015-06-16 16:22:51 -07:00
Trifonov Grigory
8dc3e7a5b8 Stats also need to be aligned. 2015-03-12 17:46:55 +03:00
Trifonov Grigory
3808c72870 Go's atomic align bug workaround. 2015-03-12 17:46:21 +03:00
Máximo Cuadros Ortiz
65ae9c16f2 extendable auth methods 2014-11-27 00:26:13 +01:00
Máximo Cuadros Ortiz
54ac589d82 Client: missing Debugf, Noticef and Tracef methods 2014-11-25 23:38:58 +01:00
Máximo Cuadros Ortiz
8a1a1925c8 fixing fatalf behaviour 2014-11-25 23:21:35 +01:00
Ken Robertson
5623b583a9 Updates for new logging to appease govet
Govet doesn't like functions that look like format handlers not ending in `f`,
such as Debug() vs Debugf(). This is changing some of the new log handling to
use 'f' function names to appease govet.

Updated the implicit handling of including the client as an arg without being
used in a format string. Now the client object simply has a Errorf function
for logging errors and it adds itself onto the format string.
2014-10-29 11:32:14 -07:00
Máximo Cuadros Ortiz
7c7578ae38 Notice and Logger messages 2014-10-16 01:16:21 +02:00
Máximo Cuadros Ortiz
6586ac4653 better client identification at logs and some performances improves 2014-10-16 00:44:56 +02:00