mirror of
https://github.com/cuberite/libevent.git
synced 2025-09-13 06:16:10 -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,6 +136,7 @@ bufferevent_readcb(int fd, short event, void *arg)
|
||||
}
|
||||
|
||||
/* Invoke the user callback - must always be called last */
|
||||
if (bufev->readcb != NULL)
|
||||
(*bufev->readcb)(bufev, bufev->cbarg);
|
||||
return;
|
||||
|
||||
@ -183,7 +184,8 @@ bufferevent_writecb(int fd, short event, void *arg)
|
||||
* Invoke the user callback if our buffer is drained or below the
|
||||
* 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);
|
||||
|
||||
return;
|
||||
@ -203,6 +205,9 @@ bufferevent_writecb(int fd, short event, void *arg)
|
||||
* The read callback is invoked whenever we read new data.
|
||||
* The write callback is invoked whenever the output buffer is drained.
|
||||
* 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 *
|
||||
|
Loading…
x
Reference in New Issue
Block a user