Mercurial > hgrepos > FreeBSD > ports > net > turnserver
comparison files/patch-src_apps_common_hiredis__libevent2.c @ 21:735b41782ed7
Update patches to 4.5.2
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Wed, 01 Sep 2021 21:56:11 +0200 |
| parents | 4a6383e57d12 |
| children | 4e4af36a675a |
comparison
equal
deleted
inserted
replaced
| 20:45f84c2bbf43 | 21:735b41782ed7 |
|---|---|
| 1 --- src/apps/common/hiredis_libevent2.c.orig | 1 --- src/apps/common/hiredis_libevent2.c.orig 2021-01-10 19:59:55 UTC |
| 2 +++ src/apps/common/hiredis_libevent2.c | 2 +++ src/apps/common/hiredis_libevent2.c |
| 3 @@ -55,6 +55,7 @@ | 3 @@ -55,6 +55,7 @@ struct redisLibeventEvents |
| 4 char *ip; | 4 char *ip; |
| 5 int port; | 5 int port; |
| 6 char *pwd; | 6 char *pwd; |
| 7 + char *usocket; | 7 + char *usocket; |
| 8 int db; | 8 int db; |
| 9 }; | 9 }; |
| 10 | 10 |
| 11 @@ -223,12 +224,13 @@ | 11 @@ -223,12 +224,13 @@ void send_message_to_redis(redis_context_handle rch, c |
| 12 | 12 |
| 13 ///////////////////////// Attach ///////////////////////////////// | 13 ///////////////////////// Attach ///////////////////////////////// |
| 14 | 14 |
| 15 -redis_context_handle redisLibeventAttach(struct event_base *base, char *ip0, int port0, char *pwd, int db) | 15 -redis_context_handle redisLibeventAttach(struct event_base *base, char *ip0, int port0, char *pwd, int db) |
| 16 +redis_context_handle redisLibeventAttach(struct event_base *base, char *ip0, int port0, char *pwd, char *usocket, int db) | 16 +redis_context_handle redisLibeventAttach(struct event_base *base, char *ip0, int port0, char *pwd, char *usocket, int db) |
| 21 | 21 |
| 22 + char sockpath[256] = "\0"; | 22 + char sockpath[256] = "\0"; |
| 23 char ip[256]; | 23 char ip[256]; |
| 24 if(ip0 && ip0[0]) | 24 if(ip0 && ip0[0]) |
| 25 STRCPY(ip,ip0); | 25 STRCPY(ip,ip0); |
| 26 @@ -239,7 +241,14 @@ | 26 @@ -239,7 +241,14 @@ redis_context_handle redisLibeventAttach(struct event_ |
| 27 if(port0>0) | 27 if(port0>0) |
| 28 port=port0; | 28 port=port0; |
| 29 | 29 |
| 30 - ac = redisAsyncConnect(ip, port); | 30 - ac = redisAsyncConnect(ip, port); |
| 31 + if(usocket) | 31 + if(usocket) |
| 37 + ac = redisAsyncConnect(ip, port); | 37 + ac = redisAsyncConnect(ip, port); |
| 38 + } | 38 + } |
| 39 if (!ac) { | 39 if (!ac) { |
| 40 fprintf(stderr,"Error: %s:%s\n", ac->errstr, ac->c.errstr); | 40 fprintf(stderr,"Error: %s:%s\n", ac->errstr, ac->c.errstr); |
| 41 return NULL; | 41 return NULL; |
| 42 @@ -256,6 +265,11 @@ | 42 @@ -256,6 +265,11 @@ redis_context_handle redisLibeventAttach(struct event_ |
| 43 e->port = port; | 43 e->port = port; |
| 44 if(pwd) | 44 if(pwd) |
| 45 e->pwd = strdup(pwd); | 45 e->pwd = strdup(pwd); |
| 46 + if(usocket) { | 46 + if(usocket) { |
| 47 + e->usocket = strdup(usocket); | 47 + e->usocket = strdup(usocket); |
| 49 + e->usocket = NULL; | 49 + e->usocket = NULL; |
| 50 + } | 50 + } |
| 51 e->db = db; | 51 e->db = db; |
| 52 | 52 |
| 53 /* Register functions to start/stop listening for events */ | 53 /* Register functions to start/stop listening for events */ |
| 54 @@ -277,6 +291,12 @@ | 54 @@ -277,6 +291,12 @@ redis_context_handle redisLibeventAttach(struct event_ |
| 55 e); | 55 e); |
| 56 | 56 |
| 57 if (e->rev == NULL || e->wev == NULL) { | 57 if (e->rev == NULL || e->wev == NULL) { |
| 58 + if(e->rev) | 58 + if(e->rev) |
| 59 + event_free(e->rev); | 59 + event_free(e->rev); |
| 62 + free(e->ip); | 62 + free(e->ip); |
| 63 + free(e->pwd); | 63 + free(e->pwd); |
| 64 free(e); | 64 free(e); |
| 65 return NULL; | 65 return NULL; |
| 66 } | 66 } |
| 67 @@ -327,7 +347,11 @@ | 67 @@ -327,7 +347,11 @@ static void redis_reconnect(struct redisLibeventEvents |
| 68 e->context = NULL; | 68 e->context = NULL; |
| 69 } | 69 } |
| 70 | 70 |
| 71 - ac = redisAsyncConnect(e->ip, e->port); | 71 - ac = redisAsyncConnect(e->ip, e->port); |
| 72 + if(e->usocket) { | 72 + if(e->usocket) { |
