Network Backends » History » Revision 1
Revision 1/3
| Next »
icy, 2008-10-11 17:43
Network Backends¶
Write¶
The network backends have to send two different types of information: * Memory chunks * File chunks
So the network api has two levels; the first selects which operation from the second level to use for a chunk type.
To ensure we do not "block" on one connection (if network is faster than we can push), we have to keep track how many
bytes we sent.
First level example:
network_status_t network_write_writev(connection *con, int fd, chunkqueue *cq);
Second level example:
network_status_t network_backend_writev(connection *con, int fd, chunkqueue *cq, goffset *write_max);
The second level backend write can handle memory and file chunks and is designed as fallback; writev only handles memory chunks, the sendfile backends handle only file chunks.
If a first level function is named like "sendfile", it uses writev for memory chunks and the sendfile backend for file chunks.
Every sendfile backend should fallback to the write backend if the sendfile syscall is not supported for specific file/socket combinations.
Read¶
For read there is not much choice; either read with read() or via openssl().
Updated by icy about 16 years ago · 1 revisions