Changeset 610 for pjproject/trunk
- Timestamp:
- Jul 18, 2006 12:10:53 AM (18 years ago)
- Location:
- pjproject/trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjlib/include/pj/compat/os_win32.h
r433 r610 74 74 * the status of non-blocking connect() operation. 75 75 */ 76 #define PJ_HAS_SO_ERROR 076 #define PJ_HAS_SO_ERROR 1 77 77 78 78 /* This value specifies the value set in errno by the OS when a non-blocking -
pjproject/trunk/pjlib/src/pj/ioqueue_common_abs.c
r592 r610 210 210 int value; 211 211 socklen_t vallen = sizeof(value); 212 int gs_rc = getsockopt(h->fd, SOL_SOCKET, SO_ERROR,213 212 int gs_rc = pj_sock_getsockopt(h->fd, SOL_SOCKET, SO_ERROR, 213 &value, &vallen); 214 214 if (gs_rc != 0) { 215 215 /* Argh!! What to do now??? … … 525 525 526 526 /* Call callback. */ 527 if (h->cb.on_connect_complete && !IS_CLOSING(h)) 528 (*h->cb.on_connect_complete)(h, -1); 527 if (h->cb.on_connect_complete && !IS_CLOSING(h)) { 528 pj_status_t status = -1; 529 #if (defined(PJ_HAS_SO_ERROR) && PJ_HAS_SO_ERROR!=0) 530 int value; 531 socklen_t vallen = sizeof(value); 532 int gs_rc = pj_sock_getsockopt(h->fd, SOL_SOCKET, SO_ERROR, 533 &value, &vallen); 534 if (gs_rc == 0) { 535 status = PJ_RETURN_OS_ERROR(value); 536 } 537 #endif 538 539 (*h->cb.on_connect_complete)(h, status); 540 } 529 541 } 530 542 -
pjproject/trunk/pjsip/src/pjsip/sip_endpoint.c
r602 r610 283 283 on_return: 284 284 pj_rwmutex_unlock_write(endpt->mod_mutex); 285 286 if (status != PJ_SUCCESS) { 287 char errmsg[PJ_ERR_MSG_SIZE]; 288 289 pj_strerror(status, errmsg, sizeof(errmsg)); 290 PJ_LOG(3,(THIS_FILE, "Module \"%.*s\" can not be unregistered: %s", 291 (int)mod->name.slen, mod->name.ptr, errmsg)); 292 } 293 285 294 return status; 286 295 } … … 527 536 528 537 /* Unregister modules. */ 529 while ((mod=endpt->module_list.prev) != &endpt->module_list) { 538 mod = endpt->module_list.prev; 539 while (mod != &endpt->module_list) { 540 pjsip_module *prev = mod->prev; 530 541 pjsip_endpt_unregister_module(endpt, mod); 542 mod = prev; 531 543 } 532 544 … … 596 608 pj_pool_release( pool ); 597 609 610 PJ_UNUSED_ARG(endpt); 598 611 /* 599 612 pj_mutex_unlock(endpt->mutex); -
pjproject/trunk/pjsip/src/pjsip/sip_transaction.c
r600 r610 649 649 static pj_status_t mod_tsx_layer_unload(void) 650 650 { 651 /* Only self destroy when there's no transaction in the table. 652 * Transaction may refuse to destroy when it has pending 653 * transmission. If we destroy the module now, application will 654 * crash when the pending transaction finally got error response 655 * from transport and when it tries to unregister itself. 656 */ 657 if (pj_hash_count(mod_tsx_layer.htable) != 0) 658 return PJ_EBUSY; 659 651 660 /* Destroy mutex. */ 652 661 pj_mutex_destroy(mod_tsx_layer.mutex); … … 928 937 if (tsx->transport_flag & TSX_HAS_PENDING_TRANSPORT) { 929 938 tsx->transport_flag |= TSX_HAS_PENDING_DESTROY; 939 tsx->tsx_user = NULL; 930 940 PJ_LOG(4,(tsx->obj_name, "Will destroy later because transport is " 931 941 "in progress")); -
pjproject/trunk/pjsip/src/pjsip/sip_transport_tcp.c
r605 r610 1241 1241 tcp = pj_ioqueue_get_user_data(key); 1242 1242 1243 /* Mark that pending connect() operation has completed. */ 1244 tcp->has_pending_connect = PJ_FALSE; 1245 1246 /* Check connect() status */ 1247 if (status != PJ_SUCCESS) { 1248 1249 tcp_perror(tcp->base.obj_name, "TCP connect() error", status); 1250 1251 /* Cancel all delayed transmits */ 1252 while (!pj_list_empty(&tcp->delayed_list)) { 1253 struct delayed_tdata *pending_tx; 1254 pj_ioqueue_op_key_t *op_key; 1255 1256 pending_tx = tcp->delayed_list.next; 1257 pj_list_erase(pending_tx); 1258 1259 op_key = (pj_ioqueue_op_key_t*)pending_tx->tdata_op_key; 1260 1261 on_write_complete(tcp->key, op_key, -status); 1262 } 1263 1264 /* We can not destroy the transport since high level objects may 1265 * still keep reference to this transport. So we can only 1266 * instruct transport manager to gracefully start the shutdown 1267 * procedure for this transport. 1268 */ 1269 if (tcp->close_reason==PJ_SUCCESS) tcp->close_reason = status; 1270 pjsip_transport_shutdown(&tcp->base); 1271 return; 1272 } 1273 1243 1274 PJ_LOG(4,(tcp->base.obj_name, 1244 1275 "TCP transport %.*s:%d is connected to %.*s:%d", … … 1250 1281 tcp->base.remote_name.port)); 1251 1282 1252 /* Mark that pending connect() operation has completed. */1253 tcp->has_pending_connect = PJ_FALSE;1254 1255 /* Check connect() status */1256 if (status != PJ_SUCCESS) {1257 1258 tcp_perror(tcp->base.obj_name, "TCP connect() error", status);1259 1260 /* We can not destroy the transport since high level objects may1261 * still keep reference to this transport. So we can only1262 * instruct transport manager to gracefully start the shutdown1263 * procedure for this transport.1264 */1265 if (tcp->close_reason==PJ_SUCCESS) tcp->close_reason = status;1266 pjsip_transport_shutdown(&tcp->base);1267 return;1268 }1269 1283 1270 1284 /* Update (again) local address, just in case local address currently
Note: See TracChangeset
for help on using the changeset viewer.