Skip to content

Commit

Permalink
Fixing issue on client disconnect killing server
Browse files Browse the repository at this point in the history
  • Loading branch information
Zohaib Sibte Hassan authored and Zohaib Sibte Hassan committed Nov 27, 2023
1 parent 0f0e9ea commit e84a8fd
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 4 deletions.
2 changes: 1 addition & 1 deletion cfg/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ var Config = &Configuration{
SeedFile: "",
CredsPassword: "",
CredsUser: "",
BindAddress: "0.0.0.0:4222",
BindAddress: ":-1",
ConnectRetries: 5,
ReconnectWaitSeconds: 2,
},
Expand Down
2 changes: 0 additions & 2 deletions stream/embedded_nats.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,6 @@ func startEmbeddedServer(nodeName string) (*embeddedNats, error) {
opts.Cluster.ListenStr = *cfg.ClusterAddrFlag
opts.Cluster.Host = host
opts.Cluster.Port = port
opts.LeafNode.Host = host
opts.LeafNode.Port = port + 1
}

if *cfg.LeafServerFlag != "" {
Expand Down
2 changes: 1 addition & 1 deletion stream/nats.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ func setupConnOptions() []nats.Option {
nats.ReconnectWait(time.Duration(cfg.Config.NATS.ReconnectWaitSeconds) * time.Second),
nats.MaxReconnects(cfg.Config.NATS.ConnectRetries),
nats.ClosedHandler(func(nc *nats.Conn) {
log.Fatal().
log.Error().
Err(nc.LastError()).
Msg("NATS client exiting")
}),
Expand Down

0 comments on commit e84a8fd

Please sign in to comment.