mirror of
https://github.com/asmogo/nws.git
synced 2025-01-18 10:01:33 +00:00
close connection on dial error
This commit is contained in:
parent
2f9dbca711
commit
701113a8f4
@ -1,4 +1,4 @@
|
||||
NOSTR_RELAYS = 'wss://localhost:7777'#NOSTR_RELAYS = 'ws://localhost:6666'
|
||||
NOSTR_RELAYS = 'ws://0.0.0.0:7777'#NOSTR_RELAYS = 'ws://localhost:6666'
|
||||
NOSTR_PRIVATE_KEY = ""
|
||||
BACKEND_HOST = 'localhost:3338'
|
||||
PUBLIC = true
|
||||
|
@ -270,7 +270,8 @@ func (e *Exit) processMessage(ctx context.Context, msg nostr.IncomingEvent) {
|
||||
func (e *Exit) handleConnect(
|
||||
ctx context.Context,
|
||||
msg nostr.IncomingEvent,
|
||||
protocolMessage *protocol.Message) {
|
||||
protocolMessage *protocol.Message,
|
||||
) {
|
||||
e.mutexMap.Lock(protocolMessage.Key.String())
|
||||
defer e.mutexMap.Unlock(protocolMessage.Key.String())
|
||||
receiver, err := nip19.EncodeProfile(msg.PubKey, []string{msg.Relay.String()})
|
||||
@ -288,6 +289,7 @@ func (e *Exit) handleConnect(
|
||||
dst, err = net.Dial("tcp", protocolMessage.Destination)
|
||||
if err != nil {
|
||||
slog.Error("could not connect to backend", "error", err)
|
||||
connection.Close()
|
||||
return
|
||||
}
|
||||
|
||||
@ -324,6 +326,7 @@ func (e *Exit) handleConnectReverse(protocolMessage *protocol.Message) {
|
||||
dst, err = net.Dial("tcp", protocolMessage.Destination)
|
||||
if err != nil {
|
||||
slog.Error("could not connect to backend", "error", err)
|
||||
connection.Close()
|
||||
return
|
||||
}
|
||||
slog.Info("connected to entry", "key", protocolMessage.Key)
|
||||
|
Loading…
Reference in New Issue
Block a user