tangled
alpha
login
or
join now
fuwn.net
/
maple
0
fork
atom
๐ A very simple static Gemini server, now with Titan support!
cpp
gemini
titan
gemini-protocol
titan-protocol
0
fork
atom
overview
issues
pulls
pipelines
refactor: pass lambda to signal
fuwn.net
4 years ago
28891f6a
cdd70a90
verified
This commit was signed with the committer's
known signature
.
fuwn.net
SSH Key Fingerprint:
SHA256:VPdFPyPbd6JkoMyWUdZ/kkTcIAt3sxjXD2XSAZ7FYC4=
+6
-10
1 changed file
expand all
collapse all
unified
split
maple
maple.cc
+6
-10
maple/maple.cc
reviewed
···
32
32
static int maple_socket;
33
33
static SSL_CTX *ssl_context;
34
34
35
35
-
auto handle_shutdown(int) -> void;
36
36
-
37
35
auto main() -> int {
38
36
sockaddr_in socket_address {};
39
37
std::vector<std::string> gemini_files;
40
38
41
39
// Try a graceful shutdown when a SIGINT is detected
42
42
-
signal(SIGINT, handle_shutdown);
40
40
+
signal(SIGINT, [](int signal_){
41
41
+
std::cout << "shutdown(" << signal_ << ")" << std::endl;
42
42
+
43
43
+
close(maple_socket);
44
44
+
SSL_CTX_free(ssl_context);
45
45
+
});
43
46
44
47
// Find and keep track of all Gemini files to serve
45
48
for (const auto &entry :
···
210
213
close(client);
211
214
}
212
215
}
213
213
-
214
214
-
auto handle_shutdown(int signal) -> void {
215
215
-
std::cout << "shutdown(" << signal << ")" << std::endl;
216
216
-
217
217
-
close(maple_socket);
218
218
-
SSL_CTX_free(ssl_context);
219
219
-
}