mirror of
https://github.com/irssi/irssi.git
synced 2026-08-10 12:23:37 +02:00
Implemented network transmit buffer. If all data couldn't be sent
immediately, it's sent after a small timeout. This cleans up some code with IRC command sending. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@478 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
parent
c6f949ef6f
commit
ee226421f1
8 changed files with 238 additions and 49 deletions
25
src/core/net-sendbuffer.h
Normal file
25
src/core/net-sendbuffer.h
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
#ifndef __NET_SENDBUFFER_H
|
||||
#define __NET_SENDBUFFER_H
|
||||
|
||||
#define DEFAULT_BUFFER_SIZE 8192
|
||||
|
||||
typedef struct _NET_SENDBUF_REC NET_SENDBUF_REC;
|
||||
|
||||
/* Create new buffer - if `bufsize' is zero or less, DEFAULT_BUFFER_SIZE
|
||||
is used */
|
||||
NET_SENDBUF_REC *net_sendbuffer_create(int handle, int bufsize);
|
||||
/* Destroy the buffer. `close' specifies if socket handle should be closed. */
|
||||
void net_sendbuffer_destroy(NET_SENDBUF_REC *rec, int close);
|
||||
|
||||
/* Send data, if all of it couldn't be sent immediately, it will be resent
|
||||
automatically after a while. Returns -1 if some unrecoverable error
|
||||
occured. */
|
||||
int net_sendbuffer_send(NET_SENDBUF_REC *rec, void *data, int size);
|
||||
|
||||
/* Returns the socket handle */
|
||||
int net_sendbuffer_handle(NET_SENDBUF_REC *rec);
|
||||
|
||||
void net_sendbuffer_init(void);
|
||||
void net_sendbuffer_deinit(void);
|
||||
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue