• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: crash when Notifier installed
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: crash when Notifier installed


  • Subject: Re: crash when Notifier installed
  • From: Rich Kubota <email@hidden>
  • Date: Thu, 10 Jul 2003 13:11:45 -0700

Hi michael,

I wonder whether you have defined OPAQUE_UPP_TYPES TRUE some where for pre-carbon development. If so, then the use of NewOTNotifyUPP is the same as using the notifier itself. This would result in the symptom you describe. If you have a prefix file, which is part of the project, take a look at some of the settings and verify that they are correct for Carbon development.

rich kubota

At 11:45 AM -0400 7/10/03, michael ferraro wrote:
/*******************************************************************************
** OpenTransport on TCP related routines
********************************************************************************/

static int otu_InitOT (Tcp *xx)
{
if (gDebug)
post ("Entering otu_initOT");

if (InitOpenTransportInContext(kInitOTForExtensionMask, &thisOTContext)){
post ("tcp_open: Could not initialize OpenTransport");
return FALSE;
}

return TRUE;
}

static int otu_Address (Tcp *xx, Symbol *host, long port)
{
long sendPort = 0;
InetHost sendHost = 0;

xx->host = 0;
xx->port = 0;

if (gDebug)
post ("Entering otu_Address");

if (host && strlen (host->s_name) > 0) {
if (OTInetStringToHost(host->s_name, &sendHost) == 0){
xx->host = host->s_name;
}
}
else {
post ("ERROR: otu_Address missing hostanme");
return FALSE;
}

if (port) {
sendPort = (InetPort) port;
xx->port = port;
}
else {
post ("ERROR: otu_Address missing portname");
return FALSE;
}

memset (&xx->sendAddr, 0, sizeof(InetAddress));
memset (&xx->sendCall, 0, sizeof(TCall));

OTInitInetAddress(&xx->sendAddr, sendPort, sendHost);

xx->sendCall.addr.buf = (UInt8 *) &xx->sendAddr;
xx->sendCall.addr.len = sizeof (xx->sendAddr);

return TRUE;
}


static int otu_Endpoint (Tcp *xx)
{
OSStatus err;
int wcount;

if (gDebug)
post ("Entering otu_Endpoint");


//
// Create a TCP endpoint
//

if (gYieldingNotifierUPP == NULL) {
gYieldingNotifierUPP = NewOTNotifyUPP (YieldingNotifier);
}

xx->ep = nil;
err = OTAsyncOpenEndpointInContext (OTCreateConfiguration(kTCPName), 0, nil, gYieldingNotifierUPP, xx, thisOTContext);
if ( err != kOTNoError ) {
post ("ERROR: OTAsyncOpenEndpoint failed with %d", err);
return FALSE;
}

//
// Idle while waiting for endpoint to complete
//

for (wcount = 1; wcount < 10000; wcount++) {
if (xx->ep)
break;

if ((wcount % 1000) == 0)
post ("Waiting for OPEN");

SystemTask();
}

if (xx->ep == nil) {
post ("Open timeout for: %s at %d", xx->host, xx->port);
return FALSE;
}

return TRUE;
}

static int otu_Bind (Tcp *xx)
{
OSStatus err = kOTNoError;
int wcount;

if (gDebug)
post ("Entering otu_Bind");

xx->bound = 0;

err = OTBind (xx->ep, nil, nil);
if ( err != kOTNoError) {
post ("ERROR: Bind failed with %d", err);
return FALSE;
}

//
// Idle while waiting for Bind to complete
//

for (wcount = 1; wcount < 10000; wcount++) {
if (xx->bound)
break;

if ((wcount % 1000) == 0)
post ("Waiting for BIND");

SystemTask();
}

if (!xx->bound) {
post ("Bind timeout for: %s at %d", xx->host, xx->port);
return FALSE;
}

return TRUE;
}

static int otu_Connect (Tcp *xx)
{
OSStatus err;
int wcount;

InetAddress sendAddr;

long sendPort = 0;
InetHost sendHost = 0;

if (gDebug)
post ("Entering otu_Connect");

xx->connect = 0;

err = OTConnect (xx->ep, &(xx->sendCall), nil);
if ( err != kOTNoDataErr && err != kOTNoError) {
post ("ERROR: Connect failed with %d", err);
return FALSE;
}

//
// Idle while waiting for connect to complete
//

for (wcount = 1; wcount < 10000; wcount++) {
if (xx->connect)
break;

if ((wcount % 1000) == 0)
post ("Waiting for CONNECT");

SystemTask();
}

if (xx->connect < 0) {
return FALSE; // was rejected or terminated (see EventHandler)
}

if (xx->connect == 0) {
post ("Connect timeout for: %s at %d", xx->host, xx->port);
return FALSE;
}

return TRUE;
}

static int otu_RcvConnect (Tcp *xx)
{
OSStatus err;
int wcount;

InetAddress recvAddr;

long recvPort = 0;
InetHost recvHost = 0;

if (gDebug)
post ("Entering otu_RcvConnect");

//
// Idle while waiting for RcvConnect to complete (assumes xx->connect=1)
//

for (wcount = 1; wcount < 10000; wcount++) {
err = OTRcvConnect (xx->ep, nil);
if ( err != kOTNoDataErr && err != kOTNoError) {
post ("ERROR: RcvConnect failed with %d", err);
return FALSE;
}

if (err == kOTNoError) {
xx->connect = 2;
break;
}

if ((wcount % 1000) == 0)
post ("Waiting for RcvCONNECT");

SystemTask();
}

if (xx->connect != 2) {
post ("RcvConnect timeout for: %s at %d", xx->host, xx->port);
return FALSE;
}

return TRUE;
}

static int otu_SyncBlock (Tcp *xx)
{
OSStatus err;

if (gDebug)
post ("Entering otu_SyncBlock");

err = OTSetSynchronous (xx->ep);
if ( err != kOTNoError ) {
post ("ERROR: SetSynchrous() failed with %d", err);
return FALSE;
}

err = OTSetBlocking (xx->ep);
if ( err != kOTNoError ) {
post ("ERROR: SetBlocking() failed with %d", err);
return FALSE;
}

err = OTUseSyncIdleEvents (xx->ep, true);
if ( err != kOTNoError ){
post ("ERROR: UseSyncIdleEvents failed with %d", err);
return FALSE;
}

return TRUE;
}


static int otu_Hail (Tcp *xx)
{
char *data = "Hello";

OTResult bytesSent;
OTResult bytesReceived;
OTFlags flags;

OTResult bc;

unsigned long wcount;
static char *ibuff [kTransferBufferSize];

if (gDebug)
post ("Entering otu_Hail");

if (xx->connect != 2)
return FALSE;

post (" -- TCP: Hailing with - %s", data);

gGotData = FALSE;
otu_Send (xx, data);

for (wcount = 1; wcount < 10000; wcount++) {
if (gGotData)
break;

if ((wcount % 1000) == 0)
post ("Waiting on %s", data);

SystemTask();
}

if (gGotData) {
post (" -- TCP: %s - Acknowledged", data);
return TRUE;
}
else {
post ("TCP ERROR: %s - Not Acknowledged", data);
return FALSE;
}
}

// ******************************************************************************
//
// N.B. be careful with "posts" these routines are called at interrupt time
//
// ******************************************************************************


static int otu_Send (Tcp *xx, char *msg)
{
OTResult bytesSent;
OTResult bytesReceived;
OTFlags flags;

int nb, state;

static char ibuff [kTransferBufferSize];

if (msg == nil)
return FALSE;

nb = OTStrLength (msg);
bytesSent = OTSnd (xx->ep, (void*) msg, nb, 0);
if (bytesSent != nb) {
post (" --> TCP ERROR: OTSnd failed %d", bytesSent);
FlashMenuBar(0L);
return FALSE;
}

bytesReceived = OTRcv (xx->ep, (void*) ibuff, kTransferBufferSize, &flags);
if (bytesReceived != kOTNoError && bytesReceived != kOTNoDataErr) {
post (" --> TCP ERROR: OTRcv failed %d", bytesReceived);
FlashMenuBar(0L);
state = FALSE;
}

if (bytesReceived > 0) {
ibuff[bytesReceived] = 0;
// post (" -- HASTY RESPONSE to %s with %s", msg, bytesReceived, ibuff);
post (" -- HASTY RESPONSE with %s", ibuff);
FlashMenuBar(0L);
state = TRUE;
}
else {
state = TRUE;
}

return state;
}

static int otu_Recv (Tcp *xx, char *msg)
{
OTFlags flags;

static char ibuff [kTransferBufferSize];
int bc;

if (msg) {
post (" -- TCP ERROR: Return buffer not implemented see MEF");
return FALSE;
}

bc = OTRcv (xx->ep, (void*) ibuff, kTransferBufferSize, &flags);
while (bc > 0) {
ibuff[bc] = 0;
bc = OTRcv (xx->ep, (void*) ibuff, kTransferBufferSize, &flags);
if (bc > 0)
post (" -- PICKUP %d %s", bc, ibuff);

}

if (bc != kOTNoDataErr) {
post (" TCP ERROR: on OTRcv follow-up %d", bc);
FlashMenuBar(0L);
}

return TRUE;
}


On Thursday, July 10, 2003, at 04:09 AM, Quinn wrote:

At 17:34 -0400 9/7/03, michael ferraro wrote:
I had tried that once before but figured I would follow your advice and try it again. I still crash as soon as the OTAsyncOpenInContext function is called.

Bummer.

Is it possible that something more needs to be done since it is a shlib. ???

I don't think so. I noticed from your previous post that you're already passing kInitOTForExtensionMask to InitOpenTransportInContext, which is the primary requirement of a shared library that calls OT.

I am at a serious loss !!

As am I.

Can you post a larger snippet of your code, showing how you call InitOpenTransportInContext, OTAsyncOpenEndpointInContext, and CloseOpenTransportInContext?

TIA
--Quinn "The Eskimo!"
<http://www.apple.com/developer/>
Apple Developer Technical Support * Networking, Communications, Hardware
_______________________________________________
macnetworkprog mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/macnetworkprog
Do not post admin requests to the list. They will be ignored.
_______________________________________________
macnetworkprog mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/macnetworkprog
Do not post admin requests to the list. They will be ignored.

--
Sincerely,
Rich Kubota
email@hidden
(408) 974-6212
_______________________________________________
macnetworkprog mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/macnetworkprog
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: crash when Notifier installed (From: michael ferraro <email@hidden>)

  • Prev by Date: Re: crash when Notifier installed
  • Next by Date: Re: crash when Notifier installed
  • Previous by thread: Re: crash when Notifier installed
  • Next by thread: Re: crash when Notifier installed
  • Index(es):
    • Date
    • Thread