Skip to content

Instantly share code, notes, and snippets.

View liviuchircu's full-sized avatar
📬
Eat. Sleep. Email. Code. Repeat.

Liviu Chircu liviuchircu

📬
Eat. Sleep. Email. Code. Repeat.
View GitHub Profile
@liviuchircu
liviuchircu / sample-do-accounting-fix
Last active June 8, 2018 08:26
Fix do_accounting() corruption
# move the do_accounting() call from here (any INVITE)
route{
if (is_method("INVITE")) {
#t_on_failure("BALANCING_FAILED");
# Initial invite
if (!has_totag()) {
...
# to here (only initial INVITES - once per call)
@liviuchircu
liviuchircu / opensipsctl
Created June 6, 2018 15:06
opensipsctl-parallel-trap
#!/bin/sh
#
# $Id$
#
# opensips control tool for maintaining opensips
#
#===================================================================
PATH=$PATH:/usr/local/sbin/
@liviuchircu
liviuchircu / opensipsl-trap-rework.sh
Last active June 6, 2018 14:53
opensipsctl trap rework
cp $(which opensipsctl) /var/tmp; sudo patch -p1 $(which opensipsctl) < <(cat <<EOF | base64 -d
ZGlmZiAtLWdpdCBhL3NjcmlwdHMvb3BlbnNpcHNjdGwgYi9zY3JpcHRzL29wZW5zaXBzY3RsCmlu
ZGV4IDI0OWU0NTEuLjlkNGY5N2MgMTAwNzU1Ci0tLSBhL3NjcmlwdHMvb3BlbnNpcHNjdGwKKysr
IGIvc2NyaXB0cy9vcGVuc2lwc2N0bApAQCAtMjYxMSwyMyArMjYxMSwzNSBAQCBvcGVuc2lwc190
cmFwKCkgewogCQltZXJyICInZ2RiJyB0b29sIG5vdCBmb3VuZDogc2V0IEdEQiB2YXJpYWJsZSB0
byBjb3JyZWN0IHRvb2wgcGF0aCIKIAkJZXhpdAogCWZpCi0JREFURT1gL2Jpbi9kYXRlICslWSVt
JWRfJUglTSVTYAotCUxPR19GSUxFPS90bXAvZ2RiX29wZW5zaXBzXyREQVRFCisJREFURT0kKC9i
aW4vZGF0ZSArJVklbSVkXyVIJU0lUykKKwlMT0dfUEFUSD0vdG1wCisJTE9HX0ZJTEU9JExPR19Q
QVRIL2dkYl9vcGVuc2lwc18kREFURQogCW1pbmZvICJUcmFwIGZpbGU6ICRMT0dfRklMRSIKLQkk
Q1RMQ01EIHBzID4gJExPR19GSUxFCi0JZWNobyAtbiAiVHJhcHBpbmcgT3BlblNJUFMgd2l0aCBn
@liviuchircu
liviuchircu / freeswitch-fix-memleak-and-fdleak.patch
Created May 9, 2018 15:41
freeswitch: Fix memleak and fdleak
diff --git a/modules/freeswitch/fs_proc.c b/modules/freeswitch/fs_proc.c
index 820da44..e91e871 100644
--- a/modules/freeswitch/fs_proc.c
+++ b/modules/freeswitch/fs_proc.c
@@ -442,7 +442,9 @@ int update_event_subscriptions(fs_evs *sock)
return ret;
}
+/* referenced by 1+ modules or has performed at least one ESL command */
#define SHOULD_KEEP_EVS(sock) ((sock)->ref > 0 || (sock)->esl_reply_id > 1)
diff --git a/net/net_tcp.c b/net/net_tcp.c
index 70b2efd..f620ca7 100644
--- a/net/net_tcp.c
+++ b/net/net_tcp.c
@@ -1437,6 +1437,7 @@ inline static int handle_worker(struct process_table* p, int fd_i)
tcpconn->lifetime=0;
break;
}
+ tcpconn_put(tcpconn);
/* must be after the de-ref*/
diff --git a/modules/rest_client/rest_methods.c b/modules/rest_client/rest_methods.c
index 930f275..dd2772d 100644
--- a/modules/rest_client/rest_methods.c
+++ b/modules/rest_client/rest_methods.c
@@ -334,8 +334,10 @@ busy_wait:
success:
clean_header_list;
+ async_parm->header_list = header_list;
async_parm->handle = handle;
diff --git a/cachedb/cachedb.h b/cachedb/cachedb.h
index 3615853..39b590c 100644
--- a/cachedb/cachedb.h
+++ b/cachedb/cachedb.h
@@ -63,7 +63,7 @@ typedef cachedb_con* (cachedb_init_f)(str *url);
typedef void (cachedb_destroy_f)(cachedb_con *con);
/* NOTE: "val->s" must be allocated in PKG memory,
- * and will be freed by the CacheDB layer! */
+ * and MUST be freed by the calling layer! */
@liviuchircu
liviuchircu / gist:c479d1617315e3e07f86062d64c0f746
Last active March 22, 2017 17:17
rest-client-async-header-list.patch
diff --git a/modules/rest_client/rest_methods.c b/modules/rest_client/rest_methods.c
index 930f275..aa52caa 100644
--- a/modules/rest_client/rest_methods.c
+++ b/modules/rest_client/rest_methods.c
@@ -333,9 +333,10 @@ busy_wait:
goto error;
success:
- clean_header_list;
+ async_parm->header_list = header_list;
@liviuchircu
liviuchircu / gist:1e3cf5323e3100a09d06201da4594e97
Created March 14, 2017 15:42
rest_client drop transfer counting
diff --git a/modules/rest_client/rest_methods.c b/modules/rest_client/rest_methods.c
index b10d416..5343db7 100644
--- a/modules/rest_client/rest_methods.c
+++ b/modules/rest_client/rest_methods.c
@@ -43,10 +43,6 @@ static char print_buff[MAX_CONTENT_TYPE_LEN];
/* additional HTTP headers for the next request */
static struct curl_slist *header_list = NULL;
-/* simultaneous ongoing transfers within this process */
-static int transfers;
@liviuchircu
liviuchircu / gist:27ea79250806b0e78aeadf19e7abd2eb
Created March 10, 2017 12:24
cachedb_mongodb build with libmongoc 1.3.6
diff --git a/modules/cachedb_mongodb/cachedb_mongodb_dbase.c b/modules/cachedb_mongodb/cachedb_mongodb_dbase.c
index 2621475..79a0528 100644
--- a/modules/cachedb_mongodb/cachedb_mongodb_dbase.c
+++ b/modules/cachedb_mongodb/cachedb_mongodb_dbase.c
@@ -90,6 +90,10 @@ static char *build_mongodb_connect_string(struct cachedb_id *id)
return ret;
}
+#ifndef MONGOC_HANDSHAKE_APPNAME_MAX
+#define MONGOC_HANDSHAKE_APPNAME_MAX 128