aboutsummaryrefslogtreecommitdiff
path: root/src/sp
diff options
context:
space:
mode:
Diffstat (limited to 'src/sp')
-rw-r--r--src/sp/transport.c6
-rw-r--r--src/sp/transport.h2
2 files changed, 5 insertions, 3 deletions
diff --git a/src/sp/transport.c b/src/sp/transport.c
index 61192e82..a2220e7b 100644
--- a/src/sp/transport.c
+++ b/src/sp/transport.c
@@ -32,14 +32,16 @@ nni_sp_tran_register(nni_sp_tran *tran)
}
nni_sp_tran *
-nni_sp_tran_find(nng_url *url)
+nni_sp_tran_find(const char *url)
{
// address is of the form "<scheme>://blah..."
nni_sp_tran *t;
nni_rwlock_rdlock(&sp_tran_lk);
NNI_LIST_FOREACH (&sp_tran_list, t) {
- if (strcmp(url->u_scheme, t->tran_scheme) == 0) {
+ size_t len = strlen(t->tran_scheme);
+ if ((strncmp(url, t->tran_scheme, len) == 0) &&
+ (strncmp(url + len, "://", 3) == 0)) {
nni_rwlock_unlock(&sp_tran_lk);
return (t);
}
diff --git a/src/sp/transport.h b/src/sp/transport.h
index 7311638f..b65486ed 100644
--- a/src/sp/transport.h
+++ b/src/sp/transport.h
@@ -186,7 +186,7 @@ struct nni_sp_tran {
// These APIs are used by the framework internally, and not for use by
// transport implementations.
-extern nni_sp_tran *nni_sp_tran_find(nng_url *);
+extern nni_sp_tran *nni_sp_tran_find(const char *);
extern void nni_sp_tran_sys_init(void);
extern void nni_sp_tran_sys_fini(void);
extern void nni_sp_tran_register(nni_sp_tran *);