watchtower/wtdb: add CSessionStatus field to ClientSession
This commit adds persisted status bit-field to ClientSessions, that can be used to modify behavior of their handling in the client. Currently, only a default CSessionActive status is defined. However, the intention is that this could later be used to signal that a session is abandoned without needing to perform a db migration to add the field. As we move forward with testing, this will likely be useful if a session gets borked and we need a simple method of the client to temporarily ignore certain sessions. The field may be useful in signaling other types of status changes, though this was the primary motivation that warranted the addition.
This commit is contained in:
2 files changed
+30
-1
No files matched your search
@@ -128,6 +128,11 @@ func WriteElement(w io.Writer, element interface{}) error {
|
||||
return err
|
||||
}
|
||||
|
||||
case uint8:
|
||||
if err := binary.Write(w, byteOrder, e); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
case bool:
|
||||
if err := binary.Write(w, byteOrder, e); err != nil {
|
||||
return err
|
||||
@@ -289,6 +294,11 @@ func ReadElement(r io.Reader, element interface{}) error {
|
||||
return err
|
||||
}
|
||||
|
||||
case *uint8:
|
||||
if err := binary.Read(r, byteOrder, e); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
case *bool:
|
||||
if err := binary.Read(r, byteOrder, e); err != nil {
|
||||
return err
|
||||
|
||||
Reference in new issue
Block a user