5 ms·
Yeah, I wasn't sure. I was looking at a Dart MySQL connection pool implementation, and that's what's done. socket.listen(onData, onDone: onSocketDone); on
by markdog12 6y ago
Yeah, I wasn't sure. I was looking at a Dart MySQL connection pool implementation, and that's what's done.
socket.listen(onData, onDone: onSocketDone);
onSocketDone() {
_closed = true;
}
write(Buffer buffer) {
if (_closed)
throw StateError('Cannot write to socket, it is closed');
...write
}
onData(RawSocketEvent event) {
if (event == RawSocketEvent.READ_CLOSED) {
_closed = true;
}
// Other events handled as well, READ, CLOSED, WRITE
}
But I don't know what's going on under the hood there.