/*
- * $Id: comm.cc,v 1.166 1997/06/18 03:06:48 wessels Exp $
+ * $Id: comm.cc,v 1.167 1997/06/18 16:00:09 wessels Exp $
*
* DEBUG: section 5 Socket Functions
* AUTHOR: Harvest Derived
{
CommWriteStateData *CommWriteState = fd_table[fd].rwstate;
CWCB *callback = NULL;
+ void *data;
fd_table[fd].rwstate = NULL;
if (CommWriteState == NULL)
return;
CommWriteState->buf = NULL;
}
callback = CommWriteState->handler;
+ data = CommWriteState->handler_data;
CommWriteState->handler = NULL;
- if (callback) {
- callback(fd,
- CommWriteState->buf,
- CommWriteState->offset,
- code,
- CommWriteState->handler_data);
- }
+ if (callback && cbdataValid(data))
+ callback(fd, CommWriteState->buf, CommWriteState->offset, code, data);
+ cbdataUnlock(data);
safe_free(CommWriteState);
}
state->handler_data = handler_data;
state->free = free_func;
fd_table[fd].rwstate = state;
+ cbdataLock(handler_data);
commSetSelect(fd,
COMM_SELECT_WRITE,
commHandleWrite,