From 69b4659b2e644506476a7285970121b3fc98c15b Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Tue, 2 Nov 2021 17:53:29 +0200 Subject: Make it so that DTail 3 incompatibility error is printed when trying to connect to it via a DTail client 4.x --- internal/clients/handlers/basehandler.go | 5 +++++ internal/protocol/protocol.go | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'internal') diff --git a/internal/clients/handlers/basehandler.go b/internal/clients/handlers/basehandler.go index 3ffea82..6f637a7 100644 --- a/internal/clients/handlers/basehandler.go +++ b/internal/clients/handlers/basehandler.go @@ -60,6 +60,11 @@ func (h *baseHandler) SendMessage(command string) error { func (h *baseHandler) Write(p []byte) (n int, err error) { for _, b := range p { switch b { + case '\n': + // Backwards compatible with DTail 3 (e.g. get error message from server + // about protocol missmatch. + h.receiveBuf.WriteByte(b) + fallthrough case protocol.MessageDelimiter: message := h.receiveBuf.String() h.handleMessage(message) diff --git a/internal/protocol/protocol.go b/internal/protocol/protocol.go index 2a95a00..d53d07e 100644 --- a/internal/protocol/protocol.go +++ b/internal/protocol/protocol.go @@ -2,7 +2,7 @@ package protocol const ( // ProtocolCompat -ibility version - ProtocolCompat string = "5" + ProtocolCompat string = "4.1" // MessageDelimiter delimits separate messages. MessageDelimiter byte = '¬' // FieldDelimiter delimits messagefields. -- cgit v1.2.3