From 354b0c90c8b4e4c6504c88227c59e753b7189d82 Mon Sep 17 00:00:00 2001 From: Volker Birk Date: Mon, 29 Aug 2016 17:39:24 +0200 Subject: [PATCH] longjmp() corrected --- src/sync_mixin.cc | 4 +--- src/sync_mixin.hh | 1 - test/sync_test.py | 7 +++++++ 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/sync_mixin.cc b/src/sync_mixin.cc index 4a5c48f..0e8f2c5 100644 --- a/src/sync_mixin.cc +++ b/src/sync_mixin.cc @@ -68,14 +68,12 @@ namespace pEp { #endif jmp_buf SyncMixIn::env; - int SyncMixIn::val; void *SyncMixIn::_msg; int SyncMixIn::inject_sync_msg(void *msg, void *management) { - val = 0; _msg = msg; - setjmp(env); + int val = setjmp(env); if (!val) do_sync_protocol(session, management); return 0; diff --git a/src/sync_mixin.hh b/src/sync_mixin.hh index c9e43c2..41d71a5 100644 --- a/src/sync_mixin.hh +++ b/src/sync_mixin.hh @@ -29,7 +29,6 @@ namespace pEp { pEp_identity *me, pEp_identity *partner); static jmp_buf env; - static int val; static void *_msg; static int inject_sync_msg(void *msg, void *management); static void *retrieve_next_sync_msg(void *management); diff --git a/test/sync_test.py b/test/sync_test.py index 6467f84..7f71a50 100644 --- a/test/sync_test.py +++ b/test/sync_test.py @@ -19,5 +19,12 @@ class Handler(SyncMixIn): handler = Handler() + +def process(path): + with open(path, 'r') as f: + text = f.read() + return Message(text) + + # this is an interactive test, so start it with python -i