Commit Graph

192 Commits

Author SHA1 Message Date
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
Ivan Kozlovic
ce79f524be Fix scheme for routes returned
When server returns routes through INFO, use "nats-route://" scheme.
A test was checking that.
Add test to check that hostname is replaced with IP.
2016-02-11 17:20:33 -07:00
Ivan Kozlovic
fc38a8336f Fix wrong check for error 2016-02-11 13:29:34 -07:00
Ivan Kozlovic
cef87212b9 Fix route url to use remote IP instead of configured url when sending in INFO protocol. 2016-02-11 11:23:41 -07:00
Ivan Kozlovic
112413a466 Fix infinite server attempt to connect route to itself
Attempt to address issue #175.
Instead of trying to detect if route URL will point to route listen address, detects that the route remoteID is server's ID.
If so, closes the connection and stop trying.
2016-02-10 14:19:54 -07:00
Derek Collison
8393c3c994 Basic INFO for cluster auto-discovery, Addresses #126 2015-12-16 12:36:24 -08: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
647213b1d7 TLS timeout handling for routes 2015-11-22 15:07:44 -08:00
Ivan Kozlovic
b62835363a Fix possible non-propagation of subscription interest to routed server.
If processRoute executes before createRoute finishes registering the route, and before a subscriber has connected (or reconnected), and the subscriber connects (or reconnects) before the route is registered, then this subscription will stay local and not be forwarded to the route.
2015-11-17 21:36:18 -07:00
Derek Collison
b8af53e67a Added in clustered TLS 2015-11-08 14:20:01 -08:00
Derek Collison
749d4f89cc First pass at client TLS support 2015-10-22 03:30:27 +02:00
Derek Collison
45564dbde2 race fixes, go1.5 on travis 2015-09-17 19:02:00 -07:00
Derek Collison
d9c7392c4d race fixes, tests 2015-06-16 12:48:50 -07:00
Oleg Shaldybin
1b39a9fe94 Fix sid for split messages
When message is split we need to copy message arguments to avoid
rewriting them with new message. Subject, reply and size were correctly
copied by sid wasn't. That led to dropping some messages in clustered
mode if they were split, and the second part was long enough to overwrite
sid in the original buffer.
2015-04-07 22:23:48 -07:00
Derek Collison
2758974735 Fixed logging bugs, added in additional tracing 2015-01-16 11:58:21 -08:00
Derek Collison
48f6086f34 Fixed some debug logging 2014-12-18 20:15:12 -08:00
Máximo Cuadros Ortiz
54ac589d82 Client: missing Debugf, Noticef and Tracef methods 2014-11-25 23:38:58 +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
Máximo Cuadros Ortiz
96d044dce4 login system abstraction 2014-10-16 00:44:22 +02:00
Michael Fraenkel
7a7b19e8c1 Prevent duplicate routes properly
* Guarantee lock when checking & adding a route
* Upgrade to a solicited route if one is seen
* Fix race issue when setting the remoteID
2014-09-13 22:06:43 -05:00
Derek Collison
13d256b8cc Fix minor races, add in 1.3 to testing, bump version 2014-07-24 08:03:04 -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
37f0e42a0e Hold lock for server on iteration 2013-10-18 13:08:29 -07:00
Derek Collison
b32bc384c4 Fixes for reflective solicited routes 2013-10-18 12:53:47 -07:00
Derek Collison
f0d98db3c4 Handle errors over routes better 2013-10-16 10:46:03 -07:00
Derek Collison
d21e2caf8c golint updates 2013-10-13 09:52:51 -07:00
Derek Collison
d322939b17 gofmt 2013-08-19 12:16:30 -07:00
Derek Collison
60f4c67bbf Cleaner way of handling the initial sends 2013-08-03 14:24:19 -07:00
Derek Collison
cf0f30200f log file support, data race fixes 2013-08-02 16:52:54 -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
de469cada6 Reconnect logic 2013-07-29 20:02:47 -07:00
Derek Collison
dd99fd12ab First pass soliciting routes with auth 2013-07-28 09:33:13 -07:00
Derek Collison
4193d6e120 fixes, auth checks 2013-07-27 23:50:07 -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
ba13445bd7 Route config setup 2013-07-27 14:17:28 -07:00