Skip to content
This repository has been archived by the owner on May 4, 2018. It is now read-only.

Commit

Permalink
unix: fix argument check / write request init order
Browse files Browse the repository at this point in the history
  • Loading branch information
bnoordhuis committed Sep 13, 2011
1 parent 21936eb commit 066dc6b
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/unix/stream.c
Expand Up @@ -635,23 +635,23 @@ int uv_write(uv_write_t* req, uv_stream_t* stream, uv_buf_t bufs[], int bufcnt,
uv_write_cb cb) {
int empty_queue;

/* Initialize the req */
uv__req_init((uv_req_t*) req);
req->cb = cb;
req->handle = stream;
req->type = UV_WRITE;
ngx_queue_init(&req->queue);

assert((stream->type == UV_TCP || stream->type == UV_NAMED_PIPE)
&& "uv_write (unix) does not yet support other types of streams");

empty_queue = (stream->write_queue_size == 0);

if (stream->fd < 0) {
uv_err_new(stream->loop, EBADF);
return -1;
}

empty_queue = (stream->write_queue_size == 0);

/* Initialize the req */
uv__req_init((uv_req_t*) req);
req->cb = cb;
req->handle = stream;
req->type = UV_WRITE;
ngx_queue_init(&req->queue);

if (bufcnt < UV_REQ_BUFSML_SIZE) {
req->bufs = req->bufsml;
}
Expand Down

0 comments on commit 066dc6b

Please sign in to comment.