summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
38c0600)
This will still allow MeshLink to make outgoing connections to other
nodes.
mesh->listen_sockets = 0;
mesh->listen_sockets = 0;
- if(!add_listen_address(mesh, address, NULL))
- return false;
+ if(!add_listen_address(mesh, address, NULL)) {
+ if(!strcmp(mesh->myport, "0")) {
+ logger(mesh, MESHLINK_WARNING, "Could not bind to port %s, asking OS to choose one for us", mesh->myport);
+ free(mesh->myport);
+ mesh->myport = strdup("0");
+ if(!mesh->myport)
+ return false;
+ if(!add_listen_address(mesh, address, NULL))
+ return false;
+ } else {
+ return false;
+ }
+ }
if(!mesh->listen_sockets) {
logger(mesh, MESHLINK_ERROR, "Unable to create any listening socket!");
if(!mesh->listen_sockets) {
logger(mesh, MESHLINK_ERROR, "Unable to create any listening socket!");