if(fn->sk != NULL)
{
fn->sk->close = 1;
+ if(fn->sk->data == fn)
+ {
+ fn->sk->data = NULL;
+ putfnetnode(fn);
+ }
putsock(fn->sk);
fn->sk = NULL;
}
}
-struct fnetnode *getfnetnode(struct fnetnode *fn)
+void getfnetnode(struct fnetnode *fn)
{
fn->refcount++;
#ifdef DEBUG
fprintf(stderr, "getfnetnode on id %i at %p, refcount=%i\n", fn->id, fn, fn->refcount);
#endif
- return(fn);
}
void putfnetnode(struct fnetnode *fn)
putfnetnode(fn);
}
-static int conncb(struct socket *sk, int err, struct fnetnode *data)
+static void conncb(struct socket *sk, int err, struct fnetnode *data)
{
if(err != 0)
{
killfnetnode(data);
putfnetnode(data);
- return(1);
+ return;
}
data->sk = sk;
fnetsetstate(data, FNN_HS);
socksettos(sk, confgetint("fnet", "fntos"));
data->fnet->connect(data);
putfnetnode(data);
- return(1);
}
static void resolvecb(struct sockaddr *addr, int addrlen, struct fnetnode *data)
killfnetnode(data);
putfnetnode(data);
} else {
- netcsconn(addr, addrlen, (int (*)(struct socket *, int, void *))conncb, data);
+ netcsconn(addr, addrlen, (void (*)(struct socket *, int, void *))conncb, data);
}
}
static struct configvar myvars[] =
{
+ /** The number of seconds to wait between searches. Most hubs
+ * require at least ten seconds, and quite often network lag will
+ * often make searches arrive to the hub more often than sent. It
+ * may be semi-dangerous to specify too low a value, since hubs
+ * will often kick users that search too often (even when the
+ * reason is network lag -- there is no way for the hub to know
+ * this), but it is quite annoying to set too high a value. 15 to
+ * 40 seconds are the recommended range (although the default is
+ * 15 seconds, it is recommended to set to 30 seconds). */
{CONF_VAR_INT, "srchwait", {.num = 15}},
+ /** The TOS value to use for hub connections (see the TOS VALUES
+ * section). */
{CONF_VAR_INT, "fntos", {.num = 0}},
+ /** The TOS value to use for peer connections (see the TOS VALUES
+ * section). */
{CONF_VAR_INT, "fnptos", {.num = 0}},
+ /** Specifies a maximum number of simultaneously connected
+ * hubs. Attempts to connect to new hubs beyond this limit will
+ * return an error. Set to zero to remove the limit. */
{CONF_VAR_INT, "maxnodes", {.num = 0}},
{CONF_VAR_END}
};