src/dps8/fnpuv.c
// Create and start a write request
Create and start a write request
Create and start a write request
void fnpuv_start_write_actual (uv_tcp_t * client, char * data, ssize_t datalen)
  {
    if (! client || uv_is_closing ((uv_handle_t *) client))
      return;
    uv_write_t * req = (uv_write_t *) malloc (sizeof (uv_write_t));
    memset (req, 0, sizeof (uv_write_t));
    uv_buf_t buf = uv_buf_init ((char *) malloc ((unsigned long) datalen), (uint) datalen);
#ifdef USE_REQ_DATA
    req->data = buf.base;
#endif
    memcpy (buf.base, data, (unsigned long) datalen);
    int ret = uv_write (req, (uv_stream_t *) client, & buf, 1, fuv_write_cb);
    if (ret < 0 && ret != -EBADF)
      sim_printf ("[FNP emulation: uv_write returns %d]\n", ret);
  }
void fnpuv_start_write_actual ( uv_tcp_t * client , char * data , ssize_t datalen ) { if ( ! client || uv_is_closing ( ( uv_handle_t * ) client ) ) return ; uv_write_t * req = ( uv_write_t * ) malloc ( sizeof ( uv_write_t ) ) ; memset ( req , 0 , sizeof ( uv_write_t ) ) ; uv_buf_t buf = uv_buf_init ( ( char * ) malloc ( ( unsigned long ) datalen ) , ( uint ) datalen ) ; #ifdef USE_REQ_DATA req -> data = buf . base ; #endif memcpy ( buf . base , data , ( unsigned long ) datalen ) ; int ret = uv_write ( req , ( uv_stream_t * ) client , & buf , 1 , fuv_write_cb ) ; if ( ret < 0 && ret != - EBADF ) sim_printf ( " \n " , ret ) ; }
Create and start a write request
Create and start a write request
// This makes sure that bufs*.base and bufsml*.base are NULL //sim_printf ("allocated req %p data %p\n", req, buf.base); //sim_printf ("fnpuv_start_write_actual req %p buf.base %p\n", req, buf.base); // There seems to be a race condition when Mulitcs signals a disconnect_line; // We close the socket, but Mulitcs is still writing its goodbye text trailing // NULs. // If the socket has been closed, write will return BADF; just ignore it.