void* collabclient_new( char* address, int port ) { #ifdef BUILD_COLLAB printf("collabclient_new() address:%s port:%d\n", address, port ); cloneclient_t *cc = 0; cc = (cloneclient_t *) zmalloc (sizeof (cloneclient_t)); cc->magic_number = MAGIC_VALUE; cc->ctx = obtainMainZMQContext(); cc->loop = 0; cc->address = copy( address ); cc->port = port; cc->kvmap = zhash_new(); cc->publisher_sendseq = 1; cc->sequence = 0; cc->preserveUndo = 0; cc->roundTripTimerWaitingSeq = 0; collabclient_remakeSockets( cc ); int32 roundTripTimerMS = pref_collab_roundTripTimerMS; cc->roundTripTimer = BackgroundTimer_new( roundTripTimerMS, collabclient_roundTripTimer, cc ); return cc; #endif return 0; }
void collabclient_sessionReconnect( void* ccvp ) { #ifdef BUILD_COLLAB cloneclient_t* cc = (cloneclient_t*)ccvp; zsocket_destroy( cc->ctx, cc->snapshot ); zsocket_destroy( cc->ctx, cc->subscriber ); zsocket_destroy( cc->ctx, cc->publisher ); collabclient_remakeSockets( cc ); cc->publisher_sendseq = 1; FontView* fv = FontViewFindUI( FontViewFind_byCollabPtr, cc ); if( fv ) { collabclient_sessionJoin( cc, fv ); } #endif }