[Xorp-hackers] Socket polling

Victor Faion vfaion at gmail.com
Wed Feb 11 12:37:56 PST 2009


Hello,

I was trying to setup a process that tries connect to its neighbours
over TCP and basically I wanted it to keep trying to connect to its
neighbours until it can, but I was having some trouble as the process
basically stops trying to connect when it can't connect the first
time.

I iterate over all the neighbour objects calling their connect
function which calls send_tcp_open_bind_connect. The callback given to
send_tcp_open_bind_connect just checks if there was an error and if
there was it calls connectRetry() which pretty much does the same
thing as connect (calls send_tcp_open_bind_connect and passes it the
same callback as connect). The problem is the first time when it calls
connect and fails, it just calls the socket4_user_0_1_error_event
function (saying ``Transport endpoint is not connected'' which is
expected) but then it doesn't go back into connectRetry() and no
connection is made when its neighbours are actually listening for this
connection. Is there a better/easier way of doing this polling or am I
just doing the recursing with the callback the wrong way?

Thanks,
Victor



More information about the Xorp-hackers mailing list