fix: 错误队列不能只读前两个,增加了清除功能,读完全部错误队列
This commit is contained in:
@@ -38,6 +38,26 @@ func (failingLogger) LogEvent(latencylog.Event) error {
|
||||
return errors.New("log failed")
|
||||
}
|
||||
|
||||
type recordingTXTimestampDebugLogger struct {
|
||||
mu sync.Mutex
|
||||
records []TXTimestampDebugRecord
|
||||
}
|
||||
|
||||
func (l *recordingTXTimestampDebugLogger) LogTXTimestampDebugRecord(record TXTimestampDebugRecord) error {
|
||||
l.mu.Lock()
|
||||
defer l.mu.Unlock()
|
||||
|
||||
l.records = append(l.records, record)
|
||||
return nil
|
||||
}
|
||||
|
||||
func (l *recordingTXTimestampDebugLogger) Records() []TXTimestampDebugRecord {
|
||||
l.mu.Lock()
|
||||
defer l.mu.Unlock()
|
||||
|
||||
return append([]TXTimestampDebugRecord(nil), l.records...)
|
||||
}
|
||||
|
||||
// TestSendReceiveMessage 验证 transport 可以在单条连接上正常收发 text 和 file 消息。
|
||||
func TestSendReceiveMessage(t *testing.T) {
|
||||
tests := []struct {
|
||||
|
||||
Reference in New Issue
Block a user