Skip to content

Commit

Permalink
Fixes webserver binding socket in IPv6 (#215).
Browse files Browse the repository at this point in the history
  • Loading branch information
s-vincent committed Mar 23, 2020
1 parent 3f9def3 commit c74d13b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion libs/mongooseplus/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ env = env.Clone()

local_include_dir = Dir(os.path.join('include', name))
env.Prepend(CPPPATH=[local_include_dir])
env.Append(CCFLAGS=['-DMONGOOSE_NO_FILESYSTEM', '-DNS_ENABLE_SSL'])
env.Append(CCFLAGS=['-DMONGOOSE_NO_FILESYSTEM', '-DNS_ENABLE_SSL', '-DNS_ENABLE_IPV6'])

includes = env.RInstall(dirs['root'], local_include_dir, ['*.hpp'])
library = env.StaticLibrary(target=os.path.join(str(dirs['lib']), name), source=env.RGlob('src', ['*.cpp', '*.c']))
Expand Down
2 changes: 1 addition & 1 deletion libs/mongooseplus/src/mongoose.c
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@ static sock_t ns_open_listening_socket(union socket_address *sa) {
if ((sock = socket(sa->sa.sa_family, SOCK_STREAM, 6)) != INVALID_SOCKET &&
!setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (void *) &on, sizeof(on)) &&
!bind(sock, &sa->sa, sa->sa.sa_family == AF_INET ?
sizeof(sa->sin) : sizeof(sa->sa)) &&
sizeof(sa->sin) : sizeof(struct sockaddr_in6)) &&
!listen(sock, SOMAXCONN)) {
ns_set_non_blocking_mode(sock);
// In case port was set to 0, get the real port number
Expand Down

0 comments on commit c74d13b

Please sign in to comment.