File tree Expand file tree Collapse file tree 1 file changed +3
-5
lines changed
src/adapters/CanKit.Adapter.SocketCAN Expand file tree Collapse file tree 1 file changed +3
-5
lines changed Original file line number Diff line number Diff line change @@ -251,11 +251,10 @@ public int Transmit(ReadOnlySpan<CanFrame> frames, int timeOut = 0)
251251 int sendCount = 0 ;
252252 var stopWatch = new Stopwatch ( ) ;
253253 var pollFd = new Libc . pollfd { fd = _fd . DangerousGetHandle ( ) . ToInt32 ( ) , events = Libc . POLLOUT } ;
254- var needSend = frames . ToArray ( ) ;
255- var wrote = _transceiver . Transmit ( this , needSend . AsSpan ( ) ) ;
254+ var wrote = _transceiver . Transmit ( this , frames ) ;
256255 sendCount = wrote ;
257256 var remainingTime = timeOut ;
258- while ( ( timeOut < 0 || remainingTime > 0 ) && sendCount < needSend . Length )
257+ while ( ( timeOut < 0 || remainingTime > 0 ) && sendCount < frames . Length )
259258 {
260259 remainingTime = timeOut > 0
261260 ? ( int ) Math . Max ( 0 , timeOut - stopWatch . ElapsedMilliseconds )
@@ -279,8 +278,7 @@ public int Transmit(ReadOnlySpan<CanFrame> frames, int timeOut = 0)
279278 Libc . ThrowErrno ( "poll(POLLOUT)" , "socket error" ) ;
280279 }
281280
282- wrote = _transceiver . Transmit ( this ,
283- new ArraySegment < CanFrame > ( needSend , sendCount , needSend . Length - sendCount ) . AsSpan ( ) ) ;
281+ wrote = _transceiver . Transmit ( this , frames . Slice ( sendCount , frames . Length - sendCount ) ) ;
284282 sendCount += wrote ;
285283
286284 }
You can’t perform that action at this time.
0 commit comments