fix some compiler errors

This commit is contained in:
Jeff Becker 2021-04-15 07:55:05 -04:00
parent b721b8d65b
commit f63122272d
No known key found for this signature in database
GPG Key ID: F357B3B42F6F9B05
2 changed files with 22 additions and 11 deletions

View File

@ -50,8 +50,10 @@ extern "C"
/// if srv is not NULL add an srv record for this port, the format being "thingservice" in which /// if srv is not NULL add an srv record for this port, the format being "thingservice" in which
/// will add a srv record "_udp.thingservice.ouraddress.tld" that advertises this port provide /// will add a srv record "_udp.thingservice.ouraddress.tld" that advertises this port provide
/// localAddr to forward inbound udp packets to "ip:port" if localAddr is NULL then the resulting /// localAddr to forward inbound udp packets to "ip:port" if localAddr is NULL then the resulting
/// socket MUST be drained by lokinet_udp_recvmmsg returns 0 on success returns nonzero on error /// socket MUST be drained by lokinet_udp_recvmmsg
/// in which it is an errno value ///
/// returns 0 on success
/// returns nonzero on error in which it is an errno value
int int
lokinet_udp_bind( lokinet_udp_bind(
int exposedPort, int exposedPort,
@ -61,10 +63,15 @@ extern "C"
struct lokinet_context* ctx); struct lokinet_context* ctx);
/// poll many udp sockets for activity /// poll many udp sockets for activity
/// each pollfd.fd should be set to the udp socket id
/// returns 0 on sucess /// returns 0 on sucess
///
/// returns non zero errno on error
int int
lokinet_udp_poll(struct pollfd* poll, nfds_t numsockets, struct lokinet_context* ctx); lokinet_udp_poll(
const int* socket_ids,
size_t numsockets,
const struct timespec* timeout,
struct lokinet_context* ctx);
struct lokinet_udp_pkt struct lokinet_udp_pkt
{ {
@ -76,7 +83,10 @@ extern "C"
/// analog to recvmmsg /// analog to recvmmsg
ssize_t ssize_t
lokinet_udp_recvmmsg( lokinet_udp_recvmmsg(
int socket_id, struct lokinet_udp_pkt* pkts, size_t numevents, struct lokient_context* ctx); int socket_id,
struct lokinet_udp_pkt* events,
size_t max_events,
struct lokient_context* ctx);
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -126,13 +126,13 @@ namespace
return -1; return -1;
} }
lokinet_srv_record std::optional<lokinet_srv_record>
SRVFromData(const llarp::dns::SRVData& data, std::string name) SRVFromData(const llarp::dns::SRVData& data, std::string name)
{ {
// TODO: implement me // TODO: implement me
(void)data; (void)data;
(void)name; (void)name;
return {}; return std::nullopt;
} }
} // namespace } // namespace
@ -157,10 +157,11 @@ struct lokinet_srv_lookup_private
return; return;
} }
ep->LookupServiceAsync(host, service, [self, &promise, host](auto results) { ep->LookupServiceAsync(host, service, [self, &promise, host](auto results) {
// for (const auto& result : results) for (const auto& result : results)
// { {
// self->results.emplace_back(SRVFromData(result, host)); if (auto maybe = SRVFromData(result, host))
// } self->results.emplace_back(*maybe);
}
promise.set_value(0); promise.set_value(0);
}); });
}); });