diff options
| author | Garrett D'Amore <garrett@damore.org> | 2024-11-22 18:16:24 -0800 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2024-11-22 18:25:33 -0800 |
| commit | cef6e70c0b3e92e36b6895e7d6e981b00c702f9b (patch) | |
| tree | 72db6da5a8a68418f6aa47f99c9e7e1c6eec0ce5 /src/sp/transport.c | |
| parent | 5836e6b0308d8562420256aebff29cc39f5d3344 (diff) | |
| download | nng-cef6e70c0b3e92e36b6895e7d6e981b00c702f9b.tar.gz nng-cef6e70c0b3e92e36b6895e7d6e981b00c702f9b.tar.bz2 nng-cef6e70c0b3e92e36b6895e7d6e981b00c702f9b.zip | |
Select transport using raw URL string.
This is done so that we can provide transport specific logic
for URL parsing later (we're going to want this for ZeroTier
for example.)
Diffstat (limited to 'src/sp/transport.c')
| -rw-r--r-- | src/sp/transport.c | 6 |
1 files changed, 4 insertions, 2 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); } |
