Mercurial > hg > freeDiameter
diff freeDiameter/messages.c @ 646:cfc8da9264f4
Prepared first part of the changes for #10
author | Sebastien Decugis <sdecugis@nict.go.jp> |
---|---|
date | Tue, 04 Jan 2011 16:20:50 +0900 |
parents | 638647100330 |
children | ae29bf971f20 |
line wrap: on
line diff
--- a/freeDiameter/messages.c Tue Jan 04 11:54:19 2011 +0900 +++ b/freeDiameter/messages.c Tue Jan 04 16:20:50 2011 +0900 @@ -268,7 +268,7 @@ /* Save the callback in the message */ if (anscb) { - CHECK_FCT( fd_msg_anscb_associate( *pmsg, anscb, data ) ); + CHECK_FCT( fd_msg_anscb_associate( *pmsg, anscb, data, NULL /* we should maybe use a safeguard here like 1 hour or so? */ ) ); } /* Post the message in the outgoing queue */ @@ -277,6 +277,22 @@ return 0; } +/* The variation of the same function with a timeout callback */ +int fd_msg_send_timeout ( struct msg ** pmsg, void (*anscb)(void *, struct msg **), void * data, const struct timespec *timeout ) +{ + TRACE_ENTRY("%p %p %p", pmsg, anscb, data, timeout); + CHECK_PARAMS( pmsg && anscb && timeout ); + + /* Save the callback in the message, with the timeout */ + CHECK_FCT( fd_msg_anscb_associate( *pmsg, anscb, data, timeout ) ); + + /* Post the message in the outgoing queue */ + CHECK_FCT( fd_fifo_post(fd_g_outgoing, pmsg) ); + + return 0; +} + + /* Parse a message against our dictionary, and in case of error log and eventually build the error reply -- returns the parsing status */ int fd_msg_parse_or_error( struct msg ** msg ) {