Append an optional station log and announce the software after login.
A log path that cannot be written leaves the station on the reflector, and the reflector learns which program joined. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -2,6 +2,7 @@ package station_test
|
||||
|
||||
import (
|
||||
"encoding/binary"
|
||||
"encoding/json"
|
||||
"io"
|
||||
"net"
|
||||
"os"
|
||||
@@ -283,6 +284,21 @@ func takeU32(t *testing.T, b []byte) (uint32, []byte) {
|
||||
return binary.BigEndian.Uint32(b[:4]), b[4:]
|
||||
}
|
||||
|
||||
func requireSoftwareIdentity(t *testing.T, body []byte) {
|
||||
t.Helper()
|
||||
raw, rest := takeStr(t, body)
|
||||
if len(rest) != 0 {
|
||||
t.Fatalf("software identity has %d trailing bytes", len(rest))
|
||||
}
|
||||
var got map[string]string
|
||||
if err := json.Unmarshal([]byte(raw), &got); err != nil {
|
||||
t.Fatalf("software identity %q: %v", raw, err)
|
||||
}
|
||||
if len(got) != 2 || got["sw"] != station.SoftwareName || got["swVer"] != station.SoftwareVersion {
|
||||
t.Fatalf("software identity = %#v, want sw %q and swVer %q only", got, station.SoftwareName, station.SoftwareVersion)
|
||||
}
|
||||
}
|
||||
|
||||
func takeStr(t *testing.T, b []byte) (string, []byte) {
|
||||
t.Helper()
|
||||
n, rest := takeU16(t, b)
|
||||
|
||||
Reference in New Issue
Block a user