void IceFreeListenObjs ( int count, IceListenObj *listenObjs ) { int i; for (i = 0; i < count; i++) { free (listenObjs[i]->network_id); _IceTransClose (listenObjs[i]->trans_conn); free ((char *) listenObjs[i]); } free ((char *) listenObjs); }
Status IceListenForWellKnownConnections ( char *port, int *countRet, IceListenObj **listenObjsRet, int errorLength, char *errorStringRet ) { struct _IceListenObj *listenObjs; char *networkId; int transCount, partial, i, j; Status status = 1; XtransConnInfo *transConns = NULL; if ((_IceTransMakeAllCOTSServerListeners (port, &partial, &transCount, &transConns) < 0) || (transCount < 1)) { *listenObjsRet = NULL; *countRet = 0; strncpy (errorStringRet, "Cannot establish any listening sockets", errorLength); return (0); } if ((listenObjs = malloc (transCount * sizeof (struct _IceListenObj))) == NULL) { for (i = 0; i < transCount; i++) _IceTransClose (transConns[i]); free (transConns); return (0); } *countRet = 0; for (i = 0; i < transCount; i++) { networkId = (char *)_IceTransGetMyNetworkId (transConns[i]); if (networkId) { listenObjs[*countRet].trans_conn = transConns[i]; listenObjs[*countRet].network_id = networkId; (*countRet)++; } } if (*countRet == 0) { *listenObjsRet = NULL; strncpy (errorStringRet, "Cannot establish any listening sockets", errorLength); status = 0; } else { *listenObjsRet = malloc (*countRet * sizeof (IceListenObj)); if (*listenObjsRet == NULL) { strncpy (errorStringRet, "Malloc failed", errorLength); status = 0; } else { for (i = 0; i < *countRet; i++) { (*listenObjsRet)[i] = malloc (sizeof (struct _IceListenObj)); if ((*listenObjsRet)[i] == NULL) { strncpy (errorStringRet, "Malloc failed", errorLength); for (j = 0; j < i; j++) free ((*listenObjsRet)[j]); free (*listenObjsRet); *listenObjsRet = NULL; status = 0; break; } else { *((*listenObjsRet)[i]) = listenObjs[i]; } } } } if (status == 1) { if (errorStringRet && errorLength > 0) *errorStringRet = '\0'; for (i = 0; i < *countRet; i++) { (*listenObjsRet)[i]->host_based_auth_proc = NULL; } } else { for (i = 0; i < transCount; i++) _IceTransClose (transConns[i]); } free (listenObjs); free (transConns); return (status); }
void ICVM_IceTransClose(void){ R_R0=_IceTransClose((ciptr)rSTKs32(0)); icvm_SetErr(); }
void _IceFreeConnection ( IceConn iceConn ) { if (iceConn->listen_obj == NULL) { /* * This iceConn was created with IceOpenConnection. * We keep track of all open IceConn's, so we need * to remove it from the list. */ int i; for (i = 0; i < _IceConnectionCount; i++) if (_IceConnectionObjs[i] == iceConn) break; if (i < _IceConnectionCount) { if (i < _IceConnectionCount - 1) { _IceConnectionObjs[i] = _IceConnectionObjs[_IceConnectionCount - 1]; _IceConnectionStrings[i] = _IceConnectionStrings[_IceConnectionCount - 1]; } _IceConnectionCount--; } } if (iceConn->trans_conn) _IceTransClose (iceConn->trans_conn); if (iceConn->connection_string) free (iceConn->connection_string); if (iceConn->vendor) free (iceConn->vendor); if (iceConn->release) free (iceConn->release); if (iceConn->inbuf) free (iceConn->inbuf); if (iceConn->outbuf) free (iceConn->outbuf); if (iceConn->scratch) free (iceConn->scratch); if (iceConn->process_msg_info) free ((char *) iceConn->process_msg_info); if (iceConn->connect_to_you) free ((char *) iceConn->connect_to_you); if (iceConn->protosetup_to_you) free ((char *) iceConn->protosetup_to_you); if (iceConn->connect_to_me) free ((char *) iceConn->connect_to_me); if (iceConn->protosetup_to_me) free ((char *) iceConn->protosetup_to_me); free ((char *) iceConn); }