diff options
Diffstat (limited to 'src/bank-lib/taler-fakebank-run.c')
-rw-r--r-- | src/bank-lib/taler-fakebank-run.c | 44 |
1 files changed, 34 insertions, 10 deletions
diff --git a/src/bank-lib/taler-fakebank-run.c b/src/bank-lib/taler-fakebank-run.c index 5aa8650a0..ff9dcc17c 100644 --- a/src/bank-lib/taler-fakebank-run.c +++ b/src/bank-lib/taler-fakebank-run.c | |||
@@ -42,6 +42,25 @@ static int connection_close; | |||
42 | */ | 42 | */ |
43 | static int ret; | 43 | static int ret; |
44 | 44 | ||
45 | /** | ||
46 | * Handle for the service. | ||
47 | */ | ||
48 | static struct TALER_FAKEBANK_Handle *fb; | ||
49 | |||
50 | |||
51 | /** | ||
52 | * Stop the process. | ||
53 | * | ||
54 | * @param cls NULL | ||
55 | */ | ||
56 | static void | ||
57 | do_shutdown (void *cls) | ||
58 | { | ||
59 | (void) cls; | ||
60 | TALER_FAKEBANK_stop (fb); | ||
61 | fb = NULL; | ||
62 | } | ||
63 | |||
45 | 64 | ||
46 | /** | 65 | /** |
47 | * Main function that will be run. | 66 | * Main function that will be run. |
@@ -69,7 +88,7 @@ run (void *cls, | |||
69 | TALER_config_get_currency (cfg, | 88 | TALER_config_get_currency (cfg, |
70 | ¤cy_string)) | 89 | ¤cy_string)) |
71 | { | 90 | { |
72 | ret = 1; | 91 | ret = EXIT_NOTCONFIGURED; |
73 | return; | 92 | return; |
74 | } | 93 | } |
75 | if (GNUNET_OK != | 94 | if (GNUNET_OK != |
@@ -92,15 +111,20 @@ run (void *cls, | |||
92 | "Maximum transaction history in RAM set to default of %llu\n", | 111 | "Maximum transaction history in RAM set to default of %llu\n", |
93 | ram); | 112 | ram); |
94 | } | 113 | } |
95 | if (NULL == | 114 | fb = TALER_FAKEBANK_start2 ((uint16_t) port, |
96 | TALER_FAKEBANK_start2 ((uint16_t) port, | 115 | currency_string, |
97 | currency_string, | 116 | ram, |
98 | ram, | 117 | num_threads, |
99 | num_threads, | 118 | (0 != connection_close)); |
100 | (0 != connection_close) )) | 119 | if (NULL == fb) |
101 | ret = 1; | 120 | { |
121 | ret = EXIT_FAILURE; | ||
122 | return; | ||
123 | } | ||
102 | GNUNET_free (currency_string); | 124 | GNUNET_free (currency_string); |
103 | ret = 0; | 125 | GNUNET_SCHEDULER_add_shutdown (&do_shutdown, |
126 | NULL); | ||
127 | ret = EXIT_SUCCESS; | ||
104 | } | 128 | } |
105 | 129 | ||
106 | 130 | ||
@@ -135,6 +159,6 @@ main (int argc, | |||
135 | options, | 159 | options, |
136 | &run, | 160 | &run, |
137 | NULL)) | 161 | NULL)) |
138 | return 1; | 162 | return EXIT_INVALIDARGUMENT; |
139 | return ret; | 163 | return ret; |
140 | } | 164 | } |