if (F != NULL)
return F;
- F = calloc(sizeof(fde_t), 1);
+ F = MyMalloc(sizeof(fde_t));
F->fd = fd;
+
+ F->read_impl = read;
+ F->write_impl = write;
+
list = &fd_table[fd % FD_HASH_SIZE];
dlinkAdd(F, &F->node, list);
/* Callback for completed IO events */
typedef void PF(int fd, void *);
+/* virtual function types for I/O --nenolod */
+typedef void IOFuncRead(int fd, void *buf, size_t count);
+typedef void IOFuncWrite(int fd, const void *buf, size_t count);
+
/* Callback for completed connections */
/* int fd, int status, void * */
typedef void CNCB(int fd, int, void *);
fdlist_t list; /* Which list this FD should sit on */
int comm_index; /* where in the poll list we live */
char desc[FD_DESC_SZ];
+
PF *read_handler;
void *read_data;
+
PF *write_handler;
void *write_data;
+
PF *timeout_handler;
void *timeout_data;
time_t timeout;
+
PF *flush_handler;
void *flush_data;
time_t flush_timeout;
+
+ IOReadFunc *read_impl;
+ IOWriteFunc *write_impl;
+
struct DNSQuery *dns_query;
struct
{