Răsfoiți Sursa

Revert "modules/cdp: fixed typo in len check"

This reverts commit 5dfdfd84761d061615addd30b4c59af5ca32e907.
jaybeepee 9 ani în urmă
părinte
comite
f8a178fe9a

+ 1 - 1
modules/cdp/api_process.c

@@ -108,7 +108,7 @@ int api_callback(peer *p,AAAMessage *msg,void* ptr)
             long elapsed_usecs =  (stop.tv_sec - t->started.tv_sec)*1000000 + (stop.tv_usec - t->started.tv_usec);
             long elapsed_msecs = elapsed_usecs/1000;
             if (elapsed_msecs > *latency_threshold_p) {
-                if (msg->sessionId && msg->sessionId->data.len)
+                if (msg->sessionId && msg->sessionId->data)
                     LM_ERR("Received diameter response outside of threshold (%d) - %ld (session-id: [%.*s])\n", *latency_threshold_p, elapsed_msecs, msg->sessionId->data.len, msg->sessionId->data.s);
                 else 
                     LM_ERR("Received diameter response outside of threshold (%d) - %ld (no session-id)\n", *latency_threshold_p, elapsed_msecs);

+ 8 - 0
modules/cdp/peer.c

@@ -107,3 +107,11 @@ void free_peer(peer *x,int locked)
 	shm_free(x);
 }
 
+/**
+ * "Touches" the peer by updating the last activity time to the current time.
+ * @param p - which peer to touch
+ */
+inline void touch_peer(peer *p)
+{
+	p->activity = time(0);
+}

+ 1 - 8
modules/cdp/peer.h

@@ -131,13 +131,6 @@ typedef struct _peer_t{
 peer* new_peer(str fqdn,str realm,int port,str src_addr);
 void free_peer(peer *x,int locked);
 
-/**
- * "Touches" the peer by updating the last activity time to the current time.
- * @param p - which peer to touch
- */
-inline void touch_peer(peer *p)
-{
-	p->activity = time(0);
-}
+inline void touch_peer(peer *p);
 
 #endif

+ 22 - 1
modules/cdp/transaction.c

@@ -50,7 +50,7 @@
 #include "cdp_stats.h"
 
 extern struct cdp_counters_h cdp_cnts_h;
-//trans_list=0;		/**< list of transactions */
+cdp_trans_list_t *trans_list=0;		/**< list of transactions */
 
 /**
  * Initializes the transaction structure.
@@ -153,6 +153,27 @@ inline void del_trans(AAAMessage *msg)
 	lock_release(trans_list->lock);
 }
 
+/**
+ * Return and remove the transaction from the transaction list.
+ * @param msg - the message that this transaction relates to
+ * @returns the cdp_trans_t* if found or NULL if not
+ */
+inline cdp_trans_t* cdp_take_trans(AAAMessage *msg)
+{
+	cdp_trans_t *x;
+	lock_get(trans_list->lock);
+	x = trans_list->head;
+	while(x&& x->endtoendid!=msg->endtoendId && x->hopbyhopid!=msg->hopbyhopId) x = x->next;
+	if (x){
+		if (x->prev) x->prev->next = x->next;
+		else trans_list->head = x->next;
+		if (x->next) x->next->prev = x->prev;
+		else trans_list->tail = x->prev;
+	}
+	lock_release(trans_list->lock);
+	return x;
+}
+
 /**
  * Deallocate the memory taken by a transaction.
  * @param x - the transaction to deallocate

+ 3 - 27
modules/cdp/transaction.h

@@ -51,7 +51,6 @@
 #include "diameter.h"
 #include "diameter_api.h"
 
-
 /** Diameter Transaction representation */
 typedef struct _cdp_trans_t{
 	struct timeval started;			/**< Time the transaction was created - used to measure response times */
@@ -75,33 +74,10 @@ typedef struct {
 int cdp_trans_init();
 int cdp_trans_destroy();
 
-cdp_trans_list_t *trans_list;		/**< list of transactions */
-
-extern inline cdp_trans_t* cdp_add_trans(AAAMessage *msg,AAATransactionCallback_f *cb, void *ptr,int timeout,int auto_drop);
+inline cdp_trans_t* cdp_add_trans(AAAMessage *msg,AAATransactionCallback_f *cb, void *ptr,int timeout,int auto_drop);
 void del_trans(AAAMessage *msg);
-//extern inline cdp_trans_t* cdp_take_trans(AAAMessage *msg);
-/**
- * Return and remove the transaction from the transaction list.
- * @param msg - the message that this transaction relates to
- * @returns the cdp_trans_t* if found or NULL if not
- */
-inline cdp_trans_t* cdp_take_trans(AAAMessage *msg)
-{
-        cdp_trans_t *x;
-        lock_get(trans_list->lock);
-        x = trans_list->head;
-        while(x&& x->endtoendid!=msg->endtoendId && x->hopbyhopid!=msg->hopbyhopId) x = x->next;
-        if (x){
-                if (x->prev) x->prev->next = x->next;
-                else trans_list->head = x->next;
-                if (x->next) x->next->prev = x->prev;
-                else trans_list->tail = x->prev;
-        }
-        lock_release(trans_list->lock);
-        return x;
-}
-
-extern inline void cdp_free_trans(cdp_trans_t *x);
+inline cdp_trans_t* cdp_take_trans(AAAMessage *msg);
+inline void cdp_free_trans(cdp_trans_t *x);
 
 int cdp_trans_timer(time_t now, void* ptr);