Changeset 2724 for pjproject/trunk/pjsip/src/pjsip/sip_util.c
- Timestamp:
- May 29, 2009 1:04:03 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip/src/pjsip/sip_util.c
r2435 r2724 1136 1136 via->rport_param = 0; 1137 1137 1138 pjsip_tx_data_invalidate_msg(tdata); 1139 1138 1140 /* Send message using this transport. */ 1139 1141 status = pjsip_transport_send( stateless_data->cur_transport, … … 1181 1183 /* Copy server addresses */ 1182 1184 pj_memcpy( &stateless_data->addr, addr, sizeof(pjsip_server_addresses)); 1185 1186 /* RFC 3261 section 18.1.1: 1187 * If a request is within 200 bytes of the path MTU, or if it is larger 1188 * than 1300 bytes and the path MTU is unknown, the request MUST be sent 1189 * using an RFC 2914 [43] congestion controlled transport protocol, such 1190 * as TCP. 1191 */ 1192 if (stateless_data->tdata->msg->type == PJSIP_REQUEST_MSG && 1193 addr->count > 0 && 1194 addr->entry[0].type == PJSIP_TRANSPORT_UDP) 1195 { 1196 int len; 1197 1198 /* Encode the request */ 1199 status = pjsip_tx_data_encode(stateless_data->tdata); 1200 if (status != PJ_SUCCESS) { 1201 if (stateless_data->app_cb) { 1202 pj_bool_t cont = PJ_FALSE; 1203 (*stateless_data->app_cb)(stateless_data, -status, &cont); 1204 } 1205 pjsip_tx_data_dec_ref(stateless_data->tdata); 1206 return; 1207 } 1208 1209 /* Check if request message is larger than 1300 bytes. */ 1210 len = stateless_data->tdata->buf.cur - 1211 stateless_data->tdata->buf.start; 1212 if (len >= PJSIP_UDP_SIZE_THRESHOLD) { 1213 int i; 1214 int count = stateless_data->addr.count; 1215 1216 /* Insert "TCP version" of resolved UDP addresses at the 1217 * beginning. 1218 */ 1219 if (count * 2 > PJSIP_MAX_RESOLVED_ADDRESSES) 1220 count = PJSIP_MAX_RESOLVED_ADDRESSES / 2; 1221 for (i = 0; i < count; ++i) { 1222 pj_memcpy(&stateless_data->addr.entry[i+count], 1223 &stateless_data->addr.entry[i], 1224 sizeof(stateless_data->addr.entry[0])); 1225 stateless_data->addr.entry[i].type = PJSIP_TRANSPORT_TCP; 1226 } 1227 stateless_data->addr.count = count * 2; 1228 } 1229 } 1183 1230 1184 1231 /* Process the addresses. */
Note: See TracChangeset
for help on using the changeset viewer.