@@ -8,8 +8,6 @@ import { Uint8ArrayList } from 'uint8arraylist'
8
8
import { Message } from './pb/message.js'
9
9
import type { Direction } from '@libp2p/interface/connection'
10
10
11
- const log = logger ( 'libp2p:webrtc:stream' )
12
-
13
11
export interface DataChannelOpts {
14
12
maxMessageSize : number
15
13
maxBufferedAmount : number
@@ -92,7 +90,7 @@ export class WebRTCStream extends AbstractStream {
92
90
break
93
91
94
92
default :
95
- log . error ( 'unknown datachannel state %s' , this . channel . readyState )
93
+ this . log . error ( 'unknown datachannel state %s' , this . channel . readyState )
96
94
throw new CodeError ( 'Unknown datachannel state' , 'ERR_INVALID_STATE' )
97
95
}
98
96
@@ -112,7 +110,7 @@ export class WebRTCStream extends AbstractStream {
112
110
113
111
this . channel . onclose = ( _evt ) => {
114
112
void this . close ( ) . catch ( err => {
115
- log . error ( 'error closing stream after channel closed' , err )
113
+ this . log . error ( 'error closing stream after channel closed' , err )
116
114
} )
117
115
}
118
116
@@ -145,7 +143,7 @@ export class WebRTCStream extends AbstractStream {
145
143
}
146
144
} )
147
145
. catch ( err => {
148
- log . error ( 'error processing incoming data channel messages' , err )
146
+ this . log . error ( 'error processing incoming data channel messages' , err )
149
147
} )
150
148
}
151
149
@@ -183,7 +181,7 @@ export class WebRTCStream extends AbstractStream {
183
181
184
182
this . messageQueue . append ( data )
185
183
} else {
186
- log . error ( 'unknown datachannel state %s' , this . channel . readyState )
184
+ this . log . error ( 'unknown datachannel state %s' , this . channel . readyState )
187
185
throw new CodeError ( 'Unknown datachannel state' , 'ERR_INVALID_STATE' )
188
186
}
189
187
}
@@ -242,7 +240,7 @@ export class WebRTCStream extends AbstractStream {
242
240
}
243
241
244
242
private async _sendFlag ( flag : Message . Flag ) : Promise < void > {
245
- log . trace ( 'Sending flag: %s' , flag . toString ( ) )
243
+ this . log . trace ( 'Sending flag: %s' , flag . toString ( ) )
246
244
const msgbuf = Message . encode ( { flag } )
247
245
const prefixedBuf = lengthPrefixed . encode . single ( msgbuf )
248
246
0 commit comments