Skip to content

Commit 82d4d7b

Browse files
committed
Clarify the purpose of the return value from #waitForSendDoneFor:...
Also, no need to actually store a `sendDone` temp, if we reach the end of the method we know it is true.
1 parent 9dba525 commit 82d4d7b

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/Network-Kernel/Socket.class.st

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1731,18 +1731,21 @@ Socket >> waitForSendDoneFor: timeout ifClosed: closedBlock ifTimedOut: timedOut
17311731
"Wait up until the given deadline for the current send operation to complete.
17321732
If it does not, execute <timedOutBlock>. If the connection is closed before
17331733
the send completes, execute <closedBlock>."
1734-
| startTime msecsDelta msecsElapsed sendDone |
1735-
1734+
1735+
| startTime msecsDelta msecsElapsed |
17361736
startTime := Time millisecondClockValue.
17371737
msecsDelta := (timeout * 1000) truncated.
17381738
"Connection end and final data can happen fast, so test in this order"
1739-
[ sendDone := self sendDone ] whileFalse: [
1739+
[ self sendDone ] whileFalse: [
17401740
self isConnected ifFalse: [ ^ closedBlock value ].
17411741
(msecsElapsed := Time millisecondsSince: startTime) < msecsDelta
17421742
ifFalse: [ ^ timedOutBlock value ].
17431743
writeSemaphore waitTimeoutMilliseconds: msecsDelta - msecsElapsed ].
1744-
1745-
^ sendDone
1744+
1745+
"For backward compatibility with Pharo <= 11, return a boolean indicating
1746+
whether the send is completed. The loop will only terminate when this
1747+
is the case, so simply return true."
1748+
^ true
17461749
]
17471750

17481751
{ #category : 'accessing' }

0 commit comments

Comments
 (0)