Be prepared that hp_client or hp_server might be NULL now.

MFC after:	1 week
This commit is contained in:
Pawel Jakub Dawidek 2011-02-02 08:24:26 +00:00
parent 607ebaaf0c
commit 8dd94e231b
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=218185

View File

@ -83,10 +83,17 @@ proto_common_setup(const char *addr, struct proto_conn **connp, int side)
return (-1);
TAILQ_FOREACH(proto, &protos, hp_next) {
if (side == PROTO_SIDE_CLIENT)
ret = proto->hp_client(addr, &ctx);
else /* if (side == PROTO_SIDE_SERVER_LISTEN) */
ret = proto->hp_server(addr, &ctx);
if (side == PROTO_SIDE_CLIENT) {
if (proto->hp_client == NULL)
ret = -1;
else
ret = proto->hp_client(addr, &ctx);
} else /* if (side == PROTO_SIDE_SERVER_LISTEN) */ {
if (proto->hp_server == NULL)
ret = -1;
else
ret = proto->hp_server(addr, &ctx);
}
/*
* ret == 0 - success
* ret == -1 - addr is not for this protocol