Hi Olivier,
I don't really understand this change, but if you are going to have a retry
at all you need to keep the:
if (incr_cseq) --cseq;
line because that prevents the [cseq] being different on the retry. So
either the "retry later" comment is wrong or the line is needed.
Peter
Peter Higginson
Newport Networks Ltd,
Direct line 01494 470694
http://www.newport-networks.com/
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
[EMAIL PROTECTED]
Sent: 02 November 2006 04:20
To: [EMAIL PROTECTED]
Subject: [Sipp-commits] SF.net SVN: sipp: [89] sipp/trunk
Revision: 89
http://svn.sourceforge.net/sipp/?rev=89&view=rev
Author: ojacques
Date: 2006-11-01 20:19:47 -0800 (Wed, 01 Nov 2006)
Log Message:
-----------
Enh: TCP: allow EAGAIN to be handled gracefully more than once - provided by
Charles P. Wright - IBM Research
Modified Paths:
--------------
sipp/trunk/call.cpp
sipp/trunk/sipp.cpp
sipp/trunk/sipp.hpp
Modified: sipp/trunk/call.cpp
===================================================================
--- sipp/trunk/call.cpp 2006-11-02 04:10:50 UTC (rev 88)
+++ sipp/trunk/call.cpp 2006-11-02 04:19:47 UTC (rev 89)
@@ -225,7 +225,6 @@
ERROR("Call not found");
}
}
-
}
void delete_calls(void)
@@ -1515,13 +1514,8 @@
}
if(send_status == -1) { /* Would Block on TCP */
- if (msg_index == 0 )
- delete_call(id) ;
- if (incr_cseq) --cseq;
return true; /* No step, nothing done, retry later */
- }
-
- if(send_status <-1) { /* Send error */
+ } else if(send_status <-1) { /* Send error */
return false; /* call deleted */
}
Modified: sipp/trunk/sipp.cpp
===================================================================
--- sipp/trunk/sipp.cpp 2006-11-02 04:10:50 UTC (rev 88)
+++ sipp/trunk/sipp.cpp 2006-11-02 04:19:47 UTC (rev 89)
@@ -484,6 +484,17 @@
}
+int pollset_find(int sock) {
+ int idx;
+
+ for(idx = 0; idx < pollnfds; idx++) {
+ if (pollfiles[idx].fd == sock) {
+ return idx;
+ }
+ }
+ return -1;
+}
+
int pollset_add(call * p_call, int sock)
{
@@ -1829,106 +1840,69 @@
msg,
strlen(msg),
0);
-
+
if (rc >= 0 && rc != strlen(msg))
{
- int idx;
-
/* Truncated message sent ... we need to store pending msg */
- for(idx = 0;
- idx < pollnfds;
- idx++) {
- if (pollfiles[idx].fd == s) {
- pending_msg[idx] = strdup(msg+rc);
- return 0;
- }
- }
- }
-
- if(rc <= 0) {
- TRACE_MSG((s,"Error send\n"));
-
-#ifdef EAGAIN
- if((ctrlEWGlobal == false) && (errno == EAGAIN)) {
- int L_idx ;
+ int idx = pollset_find(s);
- TRACE_MSG((s,"problem EAGAIN \n"));
-
- if (multisocket) {
- char * L_call_id;
- call * L_call_ptr;
-
- L_call_id = get_call_id(msg);
- L_call_ptr = get_call(L_call_id);
- L_call_ptr -> poll_flag_write = true ;
-
+ if (idx == -1) {
+ ERROR_P1("I was searching for congested socket %d but could not find
it in the pollset", s);
} else {
- ctrlEW = true ;
+ pending_msg[idx] = strdup(msg+rc);
}
-
- ctrlEWGlobal = true ;
-
- for(L_idx = 0;
- L_idx < pollnfds;
- L_idx++) {
- if (pollfiles[L_idx].fd == s) {
- TRACE_MSG((s,"problem EAGAIN on socket %d and poll_idx is %d
\n", pollfiles[L_idx].fd, L_idx));
- pollfiles[L_idx].events = POLLOUT ;
- }
- }
- nb_net_cong++;
- return 0;
}
+
+ if(rc <= 0) {
+#ifdef EAGAIN
+ int again = ((errno == EAGAIN) || (errno == EWOULDBLOCK)) ? errno :
0;
+#else
+ int again = (errno == EWOULDBLOCK) ? errno : 0;
#endif
+ if(again) {
+ int L_idx ;
- if((ctrlEWGlobal == false) && (errno == EWOULDBLOCK)) {
- int L_idx ;
+ if (multisocket) {
+ char * L_call_id;
+ call * L_call_ptr;
- TRACE_MSG((s,"problem EWOULDBLOCK \n"));
+ L_call_id = get_call_id(msg);
+ L_call_ptr = get_call(L_call_id);
+ L_call_ptr -> poll_flag_write = true ;
- if (multisocket) {
- char * L_call_id;
- call * L_call_ptr;
+ } else {
+ ctrlEW = true ;
+ }
- L_call_id = get_call_id(msg);
- L_call_ptr = get_call(L_call_id);
- L_call_ptr -> poll_flag_write = true ;
+ L_idx = pollset_find(s);
+ if (L_idx == -1) {
+ ERROR_P1("I was searching for congested socket %d but could not
find it in the pollset", s);
+ } else {
+ TRACE_MSG((s,"Problem %s on socket %d and poll_idx is %d \n",
+ again == EWOULDBLOCK ? "EWOULDBLOCK" : "EAGAIN",
+ pollfiles[L_idx].fd, L_idx));
+ pollfiles[L_idx].events |= POLLOUT ;
+ }
- } else {
- ctrlEW = true ;
+ nb_net_cong++;
+ return 0;
}
- ctrlEWGlobal = true ;
-
- for(L_idx = 0;
- L_idx < pollnfds;
- L_idx++) {
- if (pollfiles[L_idx].fd == s) {
- TRACE_MSG((s,"problem EWOULDBLOCK on socket %d and poll_idx
is %d \n", pollfiles[L_idx].fd, L_idx));
- pollfiles[L_idx].events = POLLOUT ;
- }
+ if(errno == EPIPE) {
+ nb_net_send_errors++;
+ if (reset_number > 0) {
+ WARNING("Broken pipe on TCP connection, remote peer "
+ "probably closed the socket");
+ start_calls = 1;
+ return -2;
+ } else {
+ ERROR("Broken pipe on TCP connection, remote peer "
+ "probably closed the socket");
+ }
}
- nb_net_cong++;
- return 0;
- }
-
-
- if(errno == EPIPE) {
nb_net_send_errors++;
- if (reset_number > 0) {
- WARNING("Broken pipe on TCP connection, remote peer "
- "probably closed the socket");
- start_calls = 1;
- return -2;
- } else {
- ERROR("Broken pipe on TCP connection, remote peer "
- "probably closed the socket");
- }
- }
-
- nb_net_send_errors++;
WARNING_NO("Unable to send TCP message");
return -2;
}
Modified: sipp/trunk/sipp.hpp
===================================================================
--- sipp/trunk/sipp.hpp 2006-11-02 04:10:50 UTC (rev 88)
+++ sipp/trunk/sipp.hpp 2006-11-02 04:19:47 UTC (rev 89)
@@ -212,8 +212,7 @@
extern bool backgroundMode _DEFVAL(false);
extern bool signalDump _DEFVAL(false);
-extern bool ctrlEW _DEFVAL(false);
-extern bool ctrlEWGlobal _DEFVAL(false);
+extern bool ctrlEW _DEFVAL(false);
extern int currentScreenToDisplay _DEFVAL
(DISPLAY_SCENARIO_SCREEN);
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job
easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Sipp-commits mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/sipp-commits
---------------
This e-mail may contain confidential and/or privileged information. If you are
not the intended recipient (or have received this e-mail in error) please
notify the sender immediately and delete this e-mail. Any unauthorized copying,
disclosure or distribution of the contents in this e-mail is strictly forbidden.
---------------
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Sipp-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sipp-users