mirror of
https://github.com/cuberite/libevent.git
synced 2025-09-12 22:10:12 -04:00
allow both read and write callbacks for bufferevents to be NULL
svn:r227
This commit is contained in:
parent
52bfcab894
commit
c1eec7aae5
@ -136,7 +136,8 @@ bufferevent_readcb(int fd, short event, void *arg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Invoke the user callback - must always be called last */
|
/* Invoke the user callback - must always be called last */
|
||||||
(*bufev->readcb)(bufev, bufev->cbarg);
|
if (bufev->readcb != NULL)
|
||||||
|
(*bufev->readcb)(bufev, bufev->cbarg);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
reschedule:
|
reschedule:
|
||||||
@ -183,7 +184,8 @@ bufferevent_writecb(int fd, short event, void *arg)
|
|||||||
* Invoke the user callback if our buffer is drained or below the
|
* Invoke the user callback if our buffer is drained or below the
|
||||||
* low watermark.
|
* low watermark.
|
||||||
*/
|
*/
|
||||||
if (EVBUFFER_LENGTH(bufev->output) <= bufev->wm_write.low)
|
if (bufev->writecb != NULL &&
|
||||||
|
EVBUFFER_LENGTH(bufev->output) <= bufev->wm_write.low)
|
||||||
(*bufev->writecb)(bufev, bufev->cbarg);
|
(*bufev->writecb)(bufev, bufev->cbarg);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@ -203,6 +205,9 @@ bufferevent_writecb(int fd, short event, void *arg)
|
|||||||
* The read callback is invoked whenever we read new data.
|
* The read callback is invoked whenever we read new data.
|
||||||
* The write callback is invoked whenever the output buffer is drained.
|
* The write callback is invoked whenever the output buffer is drained.
|
||||||
* The error callback is invoked on a write/read error or on EOF.
|
* The error callback is invoked on a write/read error or on EOF.
|
||||||
|
*
|
||||||
|
* Both read and write callbacks maybe NULL. The error callback is not
|
||||||
|
* allowed to be NULL and have to be provided always.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
struct bufferevent *
|
struct bufferevent *
|
||||||
|
Loading…
x
Reference in New Issue
Block a user