Victor Faion <[email protected]> wrote:

> 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?

Is connectRetry() a method in your protocol?

In your event handler for socket4_user_0_1_error_event you need to
handle the error conditions (e.g., schedule a call to
connectRetry()).

Also, are you saying that the first time you call
send_tcp_open_bind_connect() and it fails, the callback for that XRL
is not called at all? I would guess the callback might be called
after socket4_user_0_1_error_event is received, but I wouldn't bet
on the ordering.

Pavlin

_______________________________________________
Xorp-hackers mailing list
[email protected]
http://mailman.ICSI.Berkeley.EDU/mailman/listinfo/xorp-hackers

Reply via email to