43 Commits

Author SHA1 Message Date
Ivan Kozlovic
105237cba8 [ADDED] Multiple routes and ability to have per-account routes
New configuration fields:
```
cluster {
   ...
   pool_size: 5
   accounts: ["A", "B"]
}
```

The configuration `pool_size` in the example above means that this
server will create 5 routes to a remote server, assuming that that
server has the same `pool_size` setting.

Accounts (which are not part of the `accounts[]` configuration)
are assigned a specific route in this pool, and this will be the
same route on all servers in the cluster.

Accounts that are defined in the `accounts` field will each have
a dedicated route connection. This will allow suppression of the
account name in some of the route protocols, reducing bytes transmitted
which may increase performance.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2023-04-03 09:32:25 -06:00
Ivan Kozlovic
dce814009b [CHANGED] Enforce max_control_line for client connections only
Only check limit for CLIENT connection types, however, the check
is done for CLIENT in all conditions, not only in the case of a
split buffer as it was the case so far.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2021-01-26 15:33:39 -07:00
Derek Collison
07ef71ff98 Avoid parsing large sizes for messages
Signed-off-by: Derek Collison <derek@nats.io>
2020-06-01 16:54:41 -07:00
Derek Collison
019c105ca7 Updates based on feedback, more tests, few bug fixes
Signed-off-by: Derek Collison <derek@nats.io>
2020-05-19 14:33:06 -07:00
Derek Collison
55c77d1e4e Added support for delivery of HMSG and support for older clients
Signed-off-by: Derek Collison <derek@nats.io>
2020-05-19 14:33:06 -07:00
Derek Collison
d61f1f5d92 Add in support for client header bool in CONNECT and tests
Signed-off-by: Derek Collison <derek@nats.io>
2020-05-19 14:33:06 -07:00
Derek Collison
d51566881e First pass at headers awareness for server
Signed-off-by: Derek Collison <derek@nats.io>
2020-05-19 14:33:06 -07:00
Matthias Hanel
6a1c3fc29b Moving inbound tracing to the caller (client.parse)
Tracing for outgoing operations is always done while
holding the client lock.

Signed-off-by: Matthias Hanel <mh@synadia.com>
2020-03-04 17:31:18 -05:00
Matthias Hanel
f5bd07b36c [FIXED] trace/debug/sys_log reload will affect existing clients
Fixed #1296, by altering client state on reload

Detect a trace level change on reload and update all clients.
To avoid data races, read client.trace while holding the lock,
pass the value into functionis that trace while not holding the lock.
Delete unused client.debug.

Signed-off-by: Matthias Hanel <mh@synadia.com>
2020-03-04 13:54:15 -05:00
Matthias Hanel
2754968e33 Renaming IsErr to ErrorIs
Signed-off-by: Matthias Hanel <mh@synadia.com>
2020-02-25 19:53:09 -05:00
Matthias Hanel
d8297ddf41 Adding a go version compatibility package.
Currently enables Errors.Is functionality as ErrorsIs.
Using this functionality in errors.go and unit tests.

Signed-off-by: Matthias Hanel <mh@synadia.com>
2020-02-25 18:08:04 -05:00
Matthias Hanel
c18a5a2582 Fixing typos, copyright date and changed type in log.go/Error func
added comment and changed type Error(c,sc)

Signed-off-by: Matthias Hanel <mh@synadia.com>
2020-02-24 19:37:25 -05:00
Matthias Hanel
d1d34d2638 Suggestion to improve tracing in nats-server through wrapping errors
Signed-off-by: Matthias Hanel <mh@synadia.com>
2020-02-24 16:00:46 -05:00
Derek Collison
b8e7b9b68e Some Optimizations
1. Change outbound client structure to be smaller and more cache friendly.
2. Snapshot MaxControlLine into client structure (mcl) to avoid server opts lookup.

Signed-off-by: Derek Collison <derek@nats.io>
2019-02-04 17:07:49 -08:00
Derek Collison
934b28de1c Don't allow overruns for message payloads, fixes #884
Signed-off-by: Derek Collison <derek@nats.io>
2019-01-30 18:31:32 -08:00
Derek Collison
2d54fc3ee7 Account lookup failures, account and client limits, options reload.
Changed account lookup and validation failures to be more understandable by users.
Changed limits to be -1 for unlimited to match jwt pkg.

The limits changed exposed problems with options holding real objects causing issues with reload tests under race mode.
Longer term this code should be reworked such that options only hold config data, not real structs, etc.

Signed-off-by: Derek Collison <derek@nats.io>
2018-12-05 14:25:40 -08:00
Derek Collison
574fd62e01 Allow servers to send and receive messages directly
Signed-off-by: Derek Collison <derek@nats.io>
2018-11-29 12:15:08 -08:00
Ivan Kozlovic
0c11279946 Fixed data race with client trace flag
This was introduced with ec3115ad21

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
2018-11-07 16:33:30 -07:00
Derek Collison
47963303f8 First pass at new cluster design
Signed-off-by: Derek Collison <derek@nats.io>
2018-10-24 21:29:29 -07:00
Derek Collison
7e28af236b Support for RTT - #643
Signed-off-by: Derek Collison <derek@nats.io>
2018-06-20 20:18:59 -07:00
Ivan Kozlovic
fb972bd0fc Remove ssl_required references 2018-03-23 13:40:10 -06:00
Derek Collison
00901acc78 Update license to Apache 2 2018-03-15 22:31:07 -07:00
Waldemar Quevedo
c8f151ef51 Remove check for '\r\n' when processing pub args
The parser has already dropped CRLF by when `processPub`
is called, so can skip doing the these checks there.
2017-09-11 14:21:58 -07:00
Tyler Treat
28160f1de2 Remove global logger
gnatsd currently uses a global logger. This can cause some problems
(especially around the config-reload work), but global variables are
also just an anti-pattern in general. The current behavior is
particularly surprising because the global logger is configured through
calls to the Server.

This addresses issue #500 by removing the global logger and making it a
field on Server.
2017-05-31 16:06:31 -05:00
Ivan Kozlovic
c6d37ecf8f [IMPROVED] Route performance for larger messages 2016-08-01 19:01:34 -06:00
Ivan Kozlovic
2b8891364a Add more code coverage for server's parser
Test error conditions.
2016-04-22 14:41:19 -06: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
Ivan Kozlovic
76324844a9 Fixed handling of unprompted PONG protocols
- The number of outstanding PINGs is now reset whenever the server
receives a PONG from the client.
- Updated parser test to check c.pout.
- Added a test to check for unprompted PONGs.

Resolves issue: https://github.com/nats-io/gnatsd/issues/168
2016-03-23 14:30:44 -07:00
Waldemar Quevedo
86824713c6 Add UNSUB_SPC parser state 2016-02-02 21:39:30 -08:00
Waldemar Quevedo
c1ebd4efd8 Fix and tests for proto snippet function 2015-12-06 22:05:35 -08:00
Derek Collison
8fb92dc7e2 Fix parser bug around MSG protocol.
Make sure we do the right thing when no args are presented for an MSG, e.g. MSG <spc>.
Also do not parse at all of this is a client, only valid for routes.
2015-08-26 23:04:10 -07:00
Derek Collison
075529e2fe Properly handle and enforce max payload 2015-08-05 22:05:58 -07:00
Derek Collison
7da1e87748 copyright hygiene 2014-02-06 19:34:12 -08:00
Derek Collison
4e1502cc4c README license, copyright cleanup, etc 2013-09-30 10:16:43 -07:00
Derek Collison
d322939b17 gofmt 2013-08-19 12:16:30 -07:00
Derek Collison
8fa318738c Attach /r/n to msg to avoid extra write. Fix auth checks 2013-08-19 12:14:29 -07:00
Derek Collison
cf0f30200f log file support, data race fixes 2013-08-02 16:52:54 -07:00
Derek Collison
025b63300b 1-hop semantics for messages from routes 2013-07-29 17:09:41 -07:00
Derek Collison
5189dba7b6 Cluster startup 2013-07-27 16:29:25 -07:00
Derek Collison
b0c606fbb5 Test would pass PO with addition of PONG processing 2013-02-05 17:54:09 -08:00
Derek Collison
0ae60a4549 Added proper processing of client PONGs 2013-02-05 17:36:01 -08:00
Derek Collison
56cfcac374 Enable verbose mode 2012-11-29 16:52:10 -08:00
Derek Collison
6630efb298 first pass server 2012-11-12 14:26:38 -08:00