Hi Danek, Danek Duvall píše v čt 06. 10. 2011 v 11:31 -0700: > Milan Jurik wrote: > > > https://cr.opensolaris.org/action/browse/userland/jurikm/7095498/ > > It's easier to figure out what's going on if you ignore whitespace: > > --- data.c.~1~ Thu Mar 3 09:10:03 2011 > +++ data.c Thu Oct 6 11:21:51 2011 > @@ -337,10 +337,12 @@ > static int data_active_open(char *reason, off_t size) { > conn_t *c; > int rev; > + int retries = 0; > > if (!reason && session.xfer.filename) > reason = session.xfer.filename; > > + for (;;) { > session.d = pr_inet_create_conn(session.pool, NULL, -1, > session.c->local_addr, session.c->local_port-1, TRUE); > > @@ -370,11 +372,20 @@ > > if (pr_inet_connect(session.d->pool, session.d, &session.data_addr, > session.data_port) == -1) { > + if (session.d->xerrno == EADDRINUSE && retries < 16) { > + destroy_pool(session.d->pool); > + pr_signals_handle(); > + /* Wait up to MSL to avoid TIME_WAIT. */ > + sleep(retries++); > + continue; > + } > pr_response_add_err(R_425, _("Unable to build data connection: %s"), > strerror(session.d->xerrno)); > destroy_pool(session.d->pool); > session.d = NULL; > return -1; > + } else > + break; > } > > c = pr_inet_openrw(session.pool, session.d, NULL, PR_NETIO_STRM_DATA, >
Good point, sorry for this. > Why a linear backoff instead of exponential (retries *= 2)? > I was thinking of both but here I hope TIME_WAITed connection will be freed soon. Usually you wait few seconds (if you are not flooding the server from the client). Longer (exponential) timeouts will mean more likely interactive session will be stopped by user and we are not afraid of more tries on the connection initiator side (only FTP server TCP layer is queried). Do you see any argument for exponential backoff? > Danek Best regards, Milan _______________________________________________ userland-discuss mailing list userland-discuss@opensolaris.org http://mail.opensolaris.org/mailman/listinfo/userland-discuss