Skip to content

Commit

Permalink
allow to access the registered callbacks for a given filedescriptor
Browse files Browse the repository at this point in the history
TODO : extend the api to allow dynamic set/unset of callbacks

also bumped up the default write buffer

TODO : make it configurable
  • Loading branch information
xant committed Jan 6, 2014
1 parent 3a57adc commit 5ec0826
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/iomux.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
#include "iomux.h"

#define IOMUX_CONNECTIONS_MAX 65535
#define IOMUX_CONNECTION_BUFSIZE 16384
#define IOMUX_CONNECTION_BUFSIZE 65535
#define IOMUX_CONNECTION_SERVER (1)

int iomux_hangup = 0;
Expand Down Expand Up @@ -877,3 +877,10 @@ iomux_isempty(iomux_t *iomux)
}
return 1;
}

iomux_callbacks_t *iomux_callbacks(iomux_t *iomux, int fd)
{
if (iomux->connections[fd])
return &iomux->connections[fd]->cbs;
return NULL;
}
2 changes: 2 additions & 0 deletions src/iomux.h
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,8 @@ void iomux_destroy(iomux_t *iomux);
*/
int iomux_isempty(iomux_t *iomux);

iomux_callbacks_t *iomux_callbacks(iomux_t *iomux, int fd);

#ifdef __cplusplus
}
#endif
Expand Down

0 comments on commit 5ec0826

Please sign in to comment.