Fix behavior of TCPConnection.write when the connection gets closed half-way trough.
Should throw an exception in case of IOMode.all, but actually returned a partial result.
This commit is contained in:
parent
6c8b9c8e66
commit
73367273b5
|
@ -770,8 +770,13 @@ mixin(tracer);
|
|||
switch (res[1]) {
|
||||
default:
|
||||
throw new Exception("Error writing data to socket.");
|
||||
case IOStatus.ok: break;
|
||||
case IOStatus.disconnected: break;
|
||||
case IOStatus.ok:
|
||||
assert(mode != IOMode.all || res[2] == bytes.length);
|
||||
break;
|
||||
case IOStatus.disconnected:
|
||||
if (mode == IOMode.all && res[2] != bytes.length)
|
||||
throw new Exception("Connection closed while writing data.");
|
||||
break;
|
||||
}
|
||||
|
||||
return res[2];
|
||||
|
|
Loading…
Reference in a new issue