Commit Graph

121 Commits

Author SHA1 Message Date
Matthias Hanel
db83b8a55a Avoid all else and adhere to general style. Adding Flush as requested.
Signed-off-by: Matthias Hanel <mh@synadia.com>
2020-02-17 16:52:13 -05:00
Matthias Hanel
f7a84e3662 Removed unnecessary else
Signed-off-by: Matthias Hanel <mh@synadia.com>
2020-02-17 14:03:30 -05:00
Matthias Hanel
3fbf8cac2e parse ping_interval as duration, else assume seconds and warn
Signed-off-by: Matthias Hanel <mh@synadia.com>
2020-02-17 12:59:34 -05:00
Matthias Hanel
c7e4d261f4 recover from error during parsing or reload will cause a crash
Keep track of the last token used.
When recovering from a panic, create a configErr use that token.

Signed-off-by: Matthias Hanel <mh@synadia.com>
2020-02-10 18:51:12 -05:00
Matthias Hanel
82ebe084c9 recover from error during parsing or reload will cause a crash
This will also result in a line number where the issue is
2020-02-07 18:18:22 -05:00
Ivan Kozlovic
f046949c50 Fix ExpandPath test
Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2019-11-21 17:16:51 -07:00
Ivan Kozlovic
63138509f7 Tune some code/test for Windows
Running test suite on a Windows VM, I notice several failures.
Updated the compute of the RTT to be at least 1ns. I think that
this is just an issue with the VM I am running, but that change
will have no impact for normal situations (since setting the rtt
to the very minimum duration (1ns) instead of 0) and will prevent
some tests from failing.

Because of those same timer granularity issues, I had to add some
delays between some actions in order for time.Sub()/Since() to
actually report something more than 0.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2019-11-21 14:32:46 -07:00
Derek Collison
f0f807f99a After speaking with Ivan we are taking a better approach for initial RTT.
Ivan had the idea of using the CONNECT to establish a first estimate of RTT
without additional PING/PONGs.

Signed-off-by: Derek Collison <derek@nats.io>
2019-10-31 14:01:55 -07:00
R.I.Pienaar
bcf96fa1de Allows a descriptive server_name to be set
This adds a new config option server_name that
when set will be exposed in varz, events and more
as a descriptive name for the server.

If unset though the server_name will default to the pk

Signed-off-by: R.I.Pienaar <rip@devco.net>
2019-10-17 18:51:19 +02:00
Jaime Piña
f62f6bda70 Add tilde support for leaf node credentials
Signed-off-by: Jaime Piña <jaime@synadia.com>
2019-10-02 13:30:09 -07:00
Ivan Kozlovic
731941a18f Fixed ResponsePermissions
- Ensure that defaults are set when values are 0
- Fixed some tests
- Added some helpers in jwt tests to reduce copy/paste

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2019-09-19 14:42:38 -06:00
Jaime Piña
ab24cddc06 Add latency config
Currently, the config file doesn't recognize the latency config block in
account exports. This change exposes those settings in the config file.

Signed-off-by: Jaime Piña <jaime@synadia.com>
Signed-off-by: Waldemar Quevedo <wally@synadia.com>
2019-09-18 13:20:26 -07:00
Jaime Piña
176a19de75 Update SYS account name
Currently, the $SYSTEM subject is used in this repo, but it seems like this
subject name is out of date.

This change updates the code to use $SYS to match the documentation.
2019-09-04 13:49:59 -05:00
Ivan Kozlovic
c20afd4016 [FIXED] Connection could be closed twice
This was introduced in PR#930. The first commit had the route's
check if the flushOutbound() returned false, and if so would
locally unlock/lock the connection's lock. Unfortunately, this
was replaced in the second commit (a6aeed3a6b)
to the flushOutbound() function itself.
This causes the function closeConnection() to possibly unlock
the connection while calling flushOutbound(), which if the
connection is closed due to both a tls timeout for instance
and explicitly, it would result in the connection being scheduled
for a reconnect (if explicit gateway connection, possibly route).

Added defensive code in Gateway to register a unique outbound gateway.

Fixed a test that was now failing with newer Go version in which
they fixed url.Parse()

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2019-08-13 20:11:03 -06:00
Derek Collison
495a1a7ec3 Allow dynamic publish permissions based on reply subjects of received msgs
Signed-off-by: Derek Collison <derek@nats.io>
2019-07-25 13:17:26 -07:00
Derek Collison
7a3fb4ebe0 Merge pull request #1057 from andyxning/allow_limits_to_traced_message
allow limit to traced message
2019-07-14 21:34:31 -07:00
Andy Xie
cd214fca89 allow limit to traced message 2019-07-15 11:39:00 +08:00
Derek Collison
10d4f1ab7a Convert leafnode solicited remotes to array
Signed-off-by: Derek Collison <derek@nats.io>
2019-07-10 11:53:34 -07:00
Derek Collison
8168aa1f81 Allow sublist cache do be disabled globally
Signed-off-by: Derek Collison <derek@nats.io>
2019-07-02 07:34:02 -07:00
Waldemar Quevedo
8147adc1b0 Add support to extend leafnodes remote tls timeout
Bump default TLS timeout for leafnode connections

Add checks for when cert_file or key_file are missing in TLS config

Signed-off-by: Waldemar Quevedo <wally@synadia.com>
2019-06-14 08:04:44 -07:00
Ivan Kozlovic
451d4bb05c Change name of public function
Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2019-05-30 16:25:37 -06:00
Ivan Kozlovic
437e16ca71 Added a function to allow ignoring top-level unknown config option
This will be required for NATS Streaming server since streaming
allows user to have NATS and Streaming specific options in same
file.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2019-05-30 15:24:39 -06:00
Ivan Kozlovic
d2578f9e05 Update to connect/reconnect error reports logic
Changed the introduced new option and added a new one. The idea
is to be able to differentiate between never connected and reconnected
event. The never connected situation will be logged at first attempt
and every hour (by default, configurable).
However, once connected and if trying to reconnect, will report every
attempts by default, but this is configurable too.

These two options are supported for config reload.

Related to #1000
Related to #1001
Resolves #969

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2019-05-26 17:51:01 -06:00
Ivan Kozlovic
7272e4e317 Make the error report attempts configurable
This is a continuation of #1000. Added a configuration to specify
the number of attempts at which the repeated error is reported.
The algo is now to print only the 1st attempt and when current
attempt % <this config param> == 0.

Resolves #969

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2019-05-20 16:28:48 -06:00
Derek Collison
acfe372d63 Changes for rename from gnatsd -> nats-server
Signed-off-by: Derek Collison <derek@nats.io>
2019-05-06 15:04:24 -07:00
Ivan Kozlovic
515ca5e70f LeafNode: do hostname resolution and get random one from result
This is similar to what we do with Gateways.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2019-04-09 16:33:19 -06:00
Derek Collison
bacb73a403 First pass at leaf nodes. Basic functionality working, including gateways.
What is not completed:
1. TLS
2. config to bind local account.
3. Info updates for solicitor to track topology changes like a client.
4. CONNECT sent after INFO for nonce authroization.
5. Authorization
6. Services and Streams tests.
7. config file parsing.

Signed-off-by: Derek Collison <derek@nats.io>
2019-03-25 08:54:47 -07:00
Derek Collison
af78552549 Move ints to proper sizes for all
Signed-off-by: Derek Collison <derek@nats.io>
2019-02-05 15:19:59 -08:00
Ivan Kozlovic
d654b18476 Fixed reload of boolean flags
PR #874 caused an issue in case logtime was actually not configured
and not specified in the command line. A reload would then remove
logtime.

Revisited the fix for that and included other boolean flags, such
as debug, trace, etc..

Related to #874

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2019-01-14 19:18:00 -07:00
Ivan Kozlovic
7ad4498a09 Gateways: Remove unused permissions options
Permissions were configured but not implemented. Removing for now.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2019-01-10 09:49:36 -07:00
Derek Collison
744795ead5 Allow servers to send system events.
Specifically this is to support distributed tracking of number of account connections across clusters.
Gateways may not work yet based on attempts to only generate payloads when we know there is outside interest.

Signed-off-by: Derek Collison <derek@nats.io>
2018-12-01 13:54:25 -08:00
Ivan Kozlovic
cfc5ec4d44 Fixed test and remove grace period from total duration.
Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2018-11-28 18:25:15 -07:00
Ivan Kozlovic
e1a4cbaf70 Update to LameDuck mode
- Increase grace period to 10sec
- Make default 2min
- Reject config with value less than 30sec
- Don't wait more than 1sec between clients if there are much
  less than alloted time
- Stop after last one (was still sleeping after last client was
  closed)

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2018-11-28 18:04:26 -07:00
Ivan Kozlovic
10fd3ca0c6 Gateways [WIP]
Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2018-11-27 19:00:03 -07:00
Derek Collison
a2e310ffc1 Vendor jwt, fixes for nkey, jwt changes
Signed-off-by: Derek Collison <derek@nats.io>
2018-11-21 19:22:04 -08:00
Ivan Kozlovic
0067c3bb04 Added support for lame duck mode
When receiving SIGUSR2 signal (or -sl ldm) the server stops
accepting new clients, closes routes connections and spread the
closing of client connections based on a config lame duck duration
(default is 30sec). This will help preventing a storm of client
reconnect when a server needs to be shutdown.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2018-10-19 19:07:37 -06:00
Waldemar Quevedo
e819f15ca4 Collecting all config errors then flush before exit
Show warnings on server startup

Removes notions around `pedantic` checks and instead
just reports the warnings in case there were any, or
the collection of errors that may have been found
in the configuration file.

Signed-off-by: Waldemar Quevedo <wally@synadia.com>
2018-10-16 13:29:29 -07:00
Ivan Kozlovic
eab4af02a3 Fixed accounts users loading
Resolves #764

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2018-10-03 13:28:18 -06:00
Ivan Kozlovic
846544ecfe Merge pull request #747 from nats-io/update_route_perms
[CHANGED] Cluster permissions moved out of cluster's authorization
2018-09-11 10:04:13 -06:00
Ivan Kozlovic
e1202dd30a [CHANGED] Cluster permissions moved out of cluster's authorization
It will be possible to set subjects permissions regardless of the
presence of an authorization block.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2018-09-10 17:03:50 -06:00
Derek Collison
e8611b1f47 Make sure mixed mode supported for config files.
Use test helpers for generating tmp configs.

Signed-off-by: Derek Collison <derek@nats.io>
2018-09-10 15:29:42 -07:00
Derek Collison
3d2cb0e7d1 Basic nkey support and nonce handling
Signed-off-by: Derek Collison <derek@nats.io>
2018-09-10 15:29:42 -07:00
Derek Collison
65188f9768 Added parser for new style authorizations
Signed-off-by: Derek Collison <derek@nats.io>
2018-08-22 20:41:48 -07:00
Derek Collison
e78d587083 Added support for maximum subscriptions per connection
Signed-off-by: Derek Collison <derek@nats.io>
2018-07-01 15:13:59 -07:00
Derek Collison
3b953ce838 Allow localhost to not be defined, only need 127.0.0.1
Signed-off-by: Derek Collison <derek@nats.io>
2018-06-28 16:10:19 -07:00
Derek Collison
ec8e2636de Track closed connections and reason for closing
Signed-off-by: Derek Collison <derek@nats.io>
2018-06-25 17:56:07 -07:00
Derek Collison
049db6e854 Support for queue subscriber retries over routes
Signed-off-by: Derek Collison <derek@nats.io>
2018-06-04 17:45:05 -07:00
Derek Collison
df574ce951 varz cluster empty when not defined
Signed-off-by: Derek Collison <derek@nats.io>
2018-06-04 17:45:05 -07:00
Derek Collison
50a99241ea Slow consumer updates and latency improvements.
Use pending bytes as slow consumer trigger, so reintroduce max_pending.
Improve latency with inplace flush calls when appropriate. Utilize simple
time budget for readLoop routine.

Signed-off-by: Derek Collison <derek@nats.io>
2018-06-04 17:45:05 -07:00
Derek Collison
00901acc78 Update license to Apache 2 2018-03-15 22:31:07 -07:00