LastMessage returns a copy of the last message received by the backend.
()
| 57 | // LastMessage returns a copy of the last message received by the |
| 58 | // backend. |
| 59 | func (b *Backend) LastMessage() *Message { |
| 60 | b.mu.Lock() |
| 61 | defer b.mu.Unlock() |
| 62 | if b.lastMsg == nil { |
| 63 | return nil |
| 64 | } |
| 65 | clone := *b.lastMsg |
| 66 | clone.To = slices.Clone(b.lastMsg.To) |
| 67 | return &clone |
| 68 | } |
| 69 | |
| 70 | func (b *Backend) Reset() { |
| 71 | b.mu.Lock() |