text stringlengths 0 357 |
|---|
dc_log_warning(context, 0, "There is already another ongoing process running."); |
return 0; |
} |
context->ongoing_running = 1; |
context->shall_stop_ongoing = 0; |
return 1; |
} |
/* |
* Frees the process allocated with dc_alloc_ongoing() - independingly of dc_shall_stop_ongoing. |
* If dc_alloc_ongoing() fails, this function MUST NOT be called. |
*/ |
void dc_free_ongoing(dc_context_t* context) |
{ |
if (context==NULL || context->magic!=DC_CONTEXT_MAGIC) { |
return; |
} |
context->ongoing_running = 0; |
context->shall_stop_ongoing = 1; /* avoids dc_stop_ongoing_process() to stop the thread */ |
} |
/** |
* Signal an ongoing process to stop. |
* |
* After that, dc_stop_ongoing_process() returns _without_ waiting |
* for the ongoing process to return. |
* |
* The ongoing process will return ASAP then, however, it may |
* still take a moment. If in doubt, the caller may also decide to kill the |
* thread after a few seconds; eg. the process may hang in a |
* function not under the control of the core (eg. #DC_EVENT_HTTP_GET). Another |
* reason for dc_stop_ongoing_process() not to wait is that otherwise it |
* would be GUI-blocking and should be started in another thread then; this |
* would make things even more complicated. |
* |
* Typical ongoing processes are started by dc_configure(), |
* dc_initiate_key_transfer() or dc_imex(). As there is always at most only |
* one onging process at the same time, there is no need to define _which_ process to exit. |
* |
* @memberof dc_context_t |
* @param context The context object. |
* @return None. |
*/ |
void dc_stop_ongoing_process(dc_context_t* context) |
{ |
if (context==NULL || context->magic!=DC_CONTEXT_MAGIC) { |
return; |
} |
if (context->ongoing_running && context->shall_stop_ongoing==0) |
{ |
dc_log_info(context, 0, "Signaling the ongoing process to stop ASAP."); |
context->shall_stop_ongoing = 1; |
} |
else |
{ |
dc_log_info(context, 0, "No ongoing process to stop."); |
} |
} |
``` |
Filename: dc_context.c |
```c |
#include <sys/stat.h> |
#include <sys/types.h> |
#include <locale.h> |
#include <unistd.h> |
#include <openssl/opensslv.h> |
#include <assert.h> |
#include "dc_context.h" |
#include "dc_imap.h" |
#include "dc_smtp.h" |
#include "dc_openssl.h" |
#include "dc_mimefactory.h" |
#include "dc_tools.h" |
#include "dc_job.h" |
#include "dc_key.h" |
#include "dc_pgp.h" |
#include "dc_apeerstate.h" |
static const char* config_keys[] = { |
"addr" |
,"mail_server" |
,"mail_user" |
,"mail_pw" |
,"mail_port" |
,"send_server" |
,"send_user" |
,"send_pw" |
,"send_port" |
,"server_flags" |
,"imap_folder" // deprecated |
,"displayname" |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.