Fix: Allows address reuse for OCSP server

Enables the SO_REUSEADDR socket option to prevent "Address already in use" errors when restarting the OCSP server, improving its reliability and availability.
pull/526/head
Juliusz Sosinowicz 2025-09-19 14:03:49 +02:00
parent 35cae80512
commit e3915943b0
1 changed files with 5 additions and 0 deletions

View File

@ -345,6 +345,11 @@ int main()
perror("socket");
goto cleanup;
}
int optval = 1;
if (setsockopt(listenfd, SOL_SOCKET, SO_REUSEADDR, &optval, sizeof(optval)) < 0) {
perror("setsockopt");
goto cleanup;
}
memset(&serv_addr, 0, sizeof(serv_addr));
serv_addr.sin_family = AF_INET;
serv_addr.sin_addr.s_addr = INADDR_ANY;