fixed WIN32 build
added subscribe_to_all (wip)
This commit is contained in:
21
test/main.c
21
test/main.c
@@ -1,7 +1,3 @@
|
||||
#include <stdio.h>
|
||||
#include "../src/utils/debug.h"
|
||||
#include "../include/esc.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <winsock.h>
|
||||
#include <windows.h>
|
||||
@@ -12,6 +8,14 @@
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include "../src/utils/debug.h"
|
||||
#include "../include/esc.h"
|
||||
|
||||
void my_event_appeared(void *ctx, esc_subscription_t *s, esc_resolved_event_t *e) {
|
||||
printf("Event Appeared: ctx=%p s=%p e=%s\n", ctx, s, e->event ? e->event->event_type : e->link ? e->link->event_type : "<unresolved>");
|
||||
}
|
||||
|
||||
int main() {
|
||||
#ifdef _WIN32
|
||||
WSADATA wsaData;
|
||||
@@ -61,7 +65,7 @@ int main() {
|
||||
char uuid_buf[37];
|
||||
for (size_t i = 0; i < result->n_events; i++) {
|
||||
#ifdef _WIN32
|
||||
printf("%s %s %lld@%s %llu %llu\n", esc_uuid_format(result->events[i]->event->event_id, uuid_buf, 37),
|
||||
printf("%s %s %lld@%s %llu %llu\n", uuid_format(result->events[i]->event->event_id, uuid_buf, 37),
|
||||
#else
|
||||
printf("%s %s %ld@%s %lu %lu\n", uuid_format(result->events[i]->event->event_id, uuid_buf, 37),
|
||||
#endif
|
||||
@@ -74,8 +78,13 @@ int main() {
|
||||
} while(result->is_end_of_stream == 0);
|
||||
|
||||
if (result) esc_all_events_slice_destroy(result);
|
||||
|
||||
esc_event_appeared_callback_t my_event_appeared_callback = {my_event_appeared, 0};
|
||||
esc_subscription_t* subscription = esc_connection_subscribe_to_all(conn, BOOL_TRUE, my_event_appeared_callback, esc_empty_subscription_dropped_callback, credentials);
|
||||
|
||||
sleep(5);
|
||||
sleep(60);
|
||||
|
||||
esc_subscription_destroy(subscription);
|
||||
|
||||
esc_connection_destroy(conn);
|
||||
esc_credentials_destroy(credentials);
|
||||
|
Reference in New Issue
Block a user