Skip to content

Commit

Permalink
#64
Browse files Browse the repository at this point in the history
  • Loading branch information
Yurik72 committed Mar 2, 2021
1 parent 1583e16 commit c6249d8
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
Binary file modified .vs/ESPHap/v15/.suo
Binary file not shown.
Binary file modified .vs/slnx.sqlite
Binary file not shown.
10 changes: 9 additions & 1 deletion arduino_homekit_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ bool arduino_homekit_preinit(homekit_server_t *server);

static client_context_t cache_client_contexts[CLIENT_CONTEXT_CACHE_SIZE];
static bool is_initialized = false;
static bool mdns_announce=false;
#ifdef USE_STATIC_HTTP_BODY
byte static_http_body[512];
#endif
Expand Down Expand Up @@ -3278,6 +3279,8 @@ int homekit_server_on_url(http_parser *parser, const char *data, size_t length)
//TODO fix
//ERROR("Unknown endpoint: %s %s", http_method_str(parser->method), url);
//free(url);
CLIENT_INFO(context, "onurl -> %s", data);
mdns_announce = true;
}

return 0;
Expand Down Expand Up @@ -3619,7 +3622,8 @@ client_context_t* homekit_server_accept_client(homekit_server_t *server) {

// const struct timeval rcvtimeout = { 10, 0 }; /* 10 second timeout */
// setsockopt(s, SOL_SOCKET, SO_RCVTIMEO, &rcvtimeout, sizeof(rcvtimeout));
//if(wifiClient->remoteIP()=xxxx) // this is a bridge
//String yourIP = "192.168.0.0"; IP Bridge
//if(wifiClient->remoteIP().toString() ==yourIP) // this is a bridge
//{
// CLIENT_INFO(ct, "Home bridge IGNORED");
// wifiClient->stop();
Expand Down Expand Up @@ -4328,6 +4332,10 @@ void arduino_homekit_loop() {
optimistic_yield(1000);
update_mdns_count = 0;
}
if (mdns_announce && update_mdns_count == 5) {
MDNS.announce();
mdns_announce = false;
}
update_mdns_count++;
if (running_server != nullptr) {
if (!running_server->paired) {
Expand Down

0 comments on commit c6249d8

Please sign in to comment.