mirror of
https://github.com/neovim/neovim.git
synced 2024-12-20 11:15:14 -07:00
wstream: Make wstream_write consider the return value from uv_write
This commit is contained in:
parent
30fc6a4fd1
commit
c722e22ee6
@ -100,8 +100,7 @@ bool wstream_write(WStream *wstream, WBuffer *buffer)
|
|||||||
buffer->refcount++;
|
buffer->refcount++;
|
||||||
|
|
||||||
if (wstream->curmem > wstream->maxmem) {
|
if (wstream->curmem > wstream->maxmem) {
|
||||||
release_wbuffer(buffer);
|
goto err;
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wstream->curmem += buffer->size;
|
wstream->curmem += buffer->size;
|
||||||
@ -113,9 +112,16 @@ bool wstream_write(WStream *wstream, WBuffer *buffer)
|
|||||||
uvbuf.base = buffer->data;
|
uvbuf.base = buffer->data;
|
||||||
uvbuf.len = buffer->size;
|
uvbuf.len = buffer->size;
|
||||||
wstream->pending_reqs++;
|
wstream->pending_reqs++;
|
||||||
uv_write(req, wstream->stream, &uvbuf, 1, write_cb);
|
|
||||||
|
if (uv_write(req, wstream->stream, &uvbuf, 1, write_cb)) {
|
||||||
|
goto err;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
err:
|
||||||
|
release_wbuffer(buffer);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Creates a WBuffer object for holding output data. Instances of this
|
/// Creates a WBuffer object for holding output data. Instances of this
|
||||||
|
Loading…
Reference in New Issue
Block a user