Ah. Thanks for re-pointing these out. It turns out that a socket callback function should be a void subroutine. I had declared mine as returning a void *. I fixed this and it now compiles fine without the casts. I also removed the other nits you pointed out are not needed. Thanks.


On 09/09/09 16:23, Peter Memishian wrote:
> Just to complete this thread, here is the version we ended up with. > Changes since last time are that checks for errors on the ioctl for > setting non-blocking mode; removes the local variable "lbolt" entirely; > avoids the final call to ksocket_connect if the callback occurs; > correctly initializes the memory for the structure used for > communication with the callback; and shuts down the socket on connect > timeout to leave the socket in a known state. Thanks to all for your > help with this.

Looks good.  Still curious about those casts when assigning to ksock_cb_*;
seems to be required because your callback function returns a `void *' but
the actual definition returns `void'.  Not sure why this discrepancy
exists.

Some other nits:

 > idm_so_timed_socket_connect_cb(ksocket_t ks,
 >     ksocket_callback_event_t ev, void *arg, uintptr_t info)
 > {
 >   idm_so_timed_socket_t   *itp = (idm_so_timed_socket_t *)arg;

Cast not needed.

 >   rc = ksocket_setcallbacks(ks, &ks_cb, (void *)&it, CRED());

Likewise.

--
meem
_______________________________________________
networking-discuss mailing list
[email protected]

Reply via email to