about summary refs log tree commit diff stats
path: root/src/io/loader.nim
diff options
context:
space:
mode:
Diffstat (limited to 'src/io/loader.nim')
-rw-r--r--src/io/loader.nim7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/io/loader.nim b/src/io/loader.nim
index 7e6faab4..a8d0b969 100644
--- a/src/io/loader.nim
+++ b/src/io/loader.nim
@@ -76,10 +76,11 @@ proc loadResource(loader: FileLoader, request: Request, ostream: Stream) =
     ostream.swrite(-1) # error
     ostream.flush()
 
+var ssock: ServerSocket
 proc runFileLoader(loader: FileLoader, fd: cint) =
   if curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK:
     raise newException(Defect, "Failed to initialize libcurl.")
-  let ssock = initServerSocket(getpid())
+  ssock = initServerSocket(getpid())
   # The server has been initialized, so the main process can resume execution.
   var writef: File
   if not open(writef, FileHandle(fd), fmWrite):
@@ -88,6 +89,10 @@ proc runFileLoader(loader: FileLoader, fd: cint) =
   writef.flushFile()
   close(writef)
   discard close(fd)
+  onSignal SIGTERM, SIGINT:
+    curl_global_cleanup()
+    ssock.close()
+    quit(1)
   while true:
     let stream = ssock.acceptSocketStream()
     try:
.0&id=177651bddab145c8a56cdfeb0d57b5fd95a6d0e2'>^
312a53e ^
2a09617 ^


6838c23 ^
2a09617 ^


6838c23 ^
2a09617 ^
312a53e ^

6838c23 ^
312a53e ^
455c6f0 ^
312a53e ^
753adb9 ^


312a53e ^


753adb9 ^
8bb115d ^


217e85a ^


ddd0fa4 ^
753adb9 ^
b72bb27 ^

753adb9 ^
b72bb27 ^
1bedb8f ^
b72bb27 ^





753adb9 ^
db213fd ^








312a53e ^

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68