-
-
Save vyskocilm/077c89301bc360a965a06730fbf43b81 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Test the fact it's not a good idea to call mlm_client API when zsys_interrupted == 1; | |
*/ | |
#define MLM_BUILD_DRAFT_API | |
#include <malamute.h> | |
int main () | |
{ | |
static const char *endpoint = "ipc://@/malamute-zsys-interrupted"; | |
zactor_t *server = zactor_new (mlm_server, "Malamute-test"); | |
zstr_sendx (server, "BIND", endpoint, NULL); | |
mlm_client_t *client = mlm_client_new (); | |
mlm_client_connect (client, endpoint, 5000, "cl"); | |
zsys_debug ("CLIENT CONNECTED to endpoint"); | |
zmsg_t *msg = zmsg_new (); | |
zmsg_addstr (msg, "Hello, world"); | |
zsys_interrupted = 1; | |
zsys_debug ("CLIENT before sleep"); | |
zclock_sleep (5000); | |
zsys_debug ("CLIENT before sendto"); | |
int r = mlm_client_sendto (client, "some-mailbox", "SUBJECT", NULL, 1000, &msg); | |
zsys_debug ("CLIENT sent msg"); | |
assert (r != -1); | |
zsys_debug ("r=%d", r); | |
zclock_sleep (250); | |
zsys_debug ("DESTROY"); | |
mlm_client_destroy (&client); | |
zactor_destroy (&server); | |
zsys_debug ("End;"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment