Browse code

- ( "forward" ported from 0.9.0): reverted to the old way of checking response.dst.send_sock in t_retransmit_reply & reply_light (this fixes some t_newtran/new retrans. races)

Andrei Pelinescu-Onciul authored on 01/09/2005 13:59:17
Showing 3 changed files
... ...
@@ -59,7 +59,7 @@ MAIN_NAME=ser
59 59
 VERSION = 0
60 60
 PATCHLEVEL = 10
61 61
 SUBLEVEL =   99
62
-EXTRAVERSION = -dev15-tcp
62
+EXTRAVERSION = -dev16-tcp
63 63
 
64 64
 RELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
65 65
 OS = $(shell uname -s | sed -e s/SunOS/solaris/ | tr "[A-Z]" "[a-z]")
... ...
@@ -84,7 +84,6 @@
84 84
 #include "defs.h"
85 85
 
86 86
 
87
-#include <assert.h>
88 87
 #include "../../comp_defs.h"
89 88
 #include "../../dprint.h"
90 89
 #include "../../config.h"
... ...
@@ -64,10 +64,11 @@
64 64
  *  2004-10-01  added a new param.: restart_fr_on_each_reply (andrei)
65 65
  *  2005-03-01  force for statefull replies the incoming interface of 
66 66
  *              the request (bogdan)
67
+ *  2005-09-01  reverted to the old way of checking response.dst.send_sock
68
+ *               in t_retransmit_reply & reply_light (andrei)
67 69
  */
68 70
 
69 71
 
70
-#include <assert.h>
71 72
 
72 73
 #include "../../comp_defs.h"
73 74
 #include "../../hash_func.h"
... ...
@@ -411,16 +412,19 @@ static int _reply_light( struct cell *trans, char* buf, unsigned int len,
411 412
 	   not yet, don't try to retransmit
412 413
 	*/
413 414
 	/*
414
-	   response.dst.send_sock is valid all the time now, as it's taken
415
-	   from original request -bogdan
415
+	   response.dst.send_sock might be unset if the process that created
416
+	   the original transaction has not finished initialising the 
417
+	   retransmission buffer (see t_newtran/ init_rb).
418
+	   If reply_to_via is set and via contains a host name (and not an ip)
419
+	   the chances for this increase a lot.
420
+	 */
416 421
 	if (!trans->uas.response.dst.send_sock) {
417 422
 		LOG(L_ERR, "ERROR: _reply_light: no resolved dst to send reply to\n");
418 423
 	} else {
419
-	*/
420
-	assert(trans->uas.response.dst.send_sock);
421
-	SEND_PR_BUFFER( rb, buf, len );
422
-	DBG("DEBUG: reply sent out. buf=%p: %.9s..., shmem=%p: %.9s\n", 
423
-		buf, buf, rb->buffer, rb->buffer );
424
+		SEND_PR_BUFFER( rb, buf, len );
425
+		DBG("DEBUG: reply sent out. buf=%p: %.9s..., shmem=%p: %.9s\n", 
426
+			buf, buf, rb->buffer, rb->buffer );
427
+	}
424 428
 	pkg_free( buf ) ;
425 429
 	DBG("DEBUG: _reply_light: finished\n");
426 430
 	return 1;
... ...
@@ -870,15 +874,18 @@ int t_retransmit_reply( struct cell *t )
870 874
 	/* first check if we managed to resolve topmost Via -- if
871 875
 	   not yet, don't try to retransmit
872 876
 	*/
873
-	/* response.dst.send_sock is valid all the time now, as it's taken
874
-	   from original request -bogdan
877
+	/*
878
+	   response.dst.send_sock might be unset if the process that created
879
+	   the original transaction has not finished initialising the 
880
+	   retransmission buffer (see t_newtran/ init_rb).
881
+	   If reply_to_via is set and via contains a host name (and not an ip)
882
+	   the chances for this increase a lot.
883
+	 */
875 884
 	if (!t->uas.response.dst.send_sock) {
876 885
 		LOG(L_WARN, "WARNING: t_retransmit_reply: "
877 886
 			"no resolved dst to retransmit\n");
878 887
 		return -1;
879 888
 	}
880
-	*/
881
-	assert(t->uas.response.dst.send_sock);
882 889
 
883 890
 	/* we need to lock the transaction as messages from
884 891
 	   upstream may change it continuously