linebuf_flush(): use fde_t's.
This commit is contained in:
parent
d877759f5b
commit
5cd74a3b6c
|
@ -623,7 +623,7 @@ linebuf_putmsg(buf_head_t * bufhead, const char *format, va_list * va_args,
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
linebuf_flush(int fd, buf_head_t * bufhead)
|
linebuf_flush(fde_t *fd, buf_head_t * bufhead)
|
||||||
{
|
{
|
||||||
buf_line_t *bufline;
|
buf_line_t *bufline;
|
||||||
int retval;
|
int retval;
|
||||||
|
@ -652,7 +652,7 @@ linebuf_flush(int fd, buf_head_t * bufhead)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Now, try writing data */
|
/* Now, try writing data */
|
||||||
retval = send(fd, bufline->buf + bufhead->writeofs, bufline->len - bufhead->writeofs, 0);
|
retval = fd->write_impl(fd, bufline->buf + bufhead->writeofs, bufline->len - bufhead->writeofs);
|
||||||
|
|
||||||
if(retval <= 0)
|
if(retval <= 0)
|
||||||
return retval;
|
return retval;
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
#define __LINEBUF_H__
|
#define __LINEBUF_H__
|
||||||
|
|
||||||
#include "tools.h"
|
#include "tools.h"
|
||||||
|
#include "commio.h"
|
||||||
|
|
||||||
/* How big we want a buffer - 510 data bytes, plus space for a '\0' */
|
/* How big we want a buffer - 510 data bytes, plus space for a '\0' */
|
||||||
#define BUF_DATA_SIZE 511
|
#define BUF_DATA_SIZE 511
|
||||||
|
@ -80,7 +81,7 @@ extern void linebuf_donebuf(buf_head_t *);
|
||||||
extern int linebuf_parse(buf_head_t *, char *, int, int);
|
extern int linebuf_parse(buf_head_t *, char *, int, int);
|
||||||
extern int linebuf_get(buf_head_t *, char *, int, int, int);
|
extern int linebuf_get(buf_head_t *, char *, int, int, int);
|
||||||
extern void linebuf_putmsg(buf_head_t *, const char *, va_list *, const char *, ...);
|
extern void linebuf_putmsg(buf_head_t *, const char *, va_list *, const char *, ...);
|
||||||
extern int linebuf_flush(int, buf_head_t *);
|
extern int linebuf_flush(fde_t *, buf_head_t *);
|
||||||
extern void linebuf_attach(buf_head_t *, buf_head_t *);
|
extern void linebuf_attach(buf_head_t *, buf_head_t *);
|
||||||
extern void count_linebuf_memory(size_t *, size_t *);
|
extern void count_linebuf_memory(size_t *, size_t *);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -168,6 +168,10 @@ send_queued_write(int fd, void *data)
|
||||||
#ifdef USE_IODEBUG_HOOKS
|
#ifdef USE_IODEBUG_HOOKS
|
||||||
hook_data_int hd;
|
hook_data_int hd;
|
||||||
#endif
|
#endif
|
||||||
|
fde_t *F = comm_lookup_fd(to->localClient->fd);
|
||||||
|
if (!F)
|
||||||
|
return;
|
||||||
|
|
||||||
/* cant write anything to a dead socket. */
|
/* cant write anything to a dead socket. */
|
||||||
if(IsIOError(to))
|
if(IsIOError(to))
|
||||||
return;
|
return;
|
||||||
|
@ -182,7 +186,7 @@ send_queued_write(int fd, void *data)
|
||||||
if(linebuf_len(&to->localClient->buf_sendq))
|
if(linebuf_len(&to->localClient->buf_sendq))
|
||||||
{
|
{
|
||||||
while ((retlen =
|
while ((retlen =
|
||||||
linebuf_flush(to->localClient->fd, &to->localClient->buf_sendq)) > 0)
|
linebuf_flush(F, &to->localClient->buf_sendq)) > 0)
|
||||||
{
|
{
|
||||||
/* We have some data written .. update counters */
|
/* We have some data written .. update counters */
|
||||||
#ifdef USE_IODEBUG_HOOKS
|
#ifdef USE_IODEBUG_HOOKS
|
||||||
|
|
Loading…
Reference in New Issue