changed the return type of on_connect to void

This commit is contained in:
hyung-hwan 2019-01-16 10:42:20 +00:00
parent af20b13e04
commit 2372fc535e
3 changed files with 20 additions and 18 deletions

View File

@ -155,9 +155,9 @@ static void tcp_sck_on_disconnect (mio_dev_sck_t* tcp)
break;
}
}
static int tcp_sck_on_connect (mio_dev_sck_t* tcp)
{
static void tcp_sck_on_connect (mio_dev_sck_t* tcp)
{
mio_sckfam_t fam;
mio_scklen_t len;
mio_bch_t buf1[128], buf2[128];
@ -173,16 +173,17 @@ static int tcp_sck_on_connect (mio_dev_sck_t* tcp)
if (tcp->state & MIO_DEV_SCK_CONNECTED)
{
printf ("DEVICE connected to a remote server... LOCAL %s:%d REMOTE %s:%d.", buf1, mio_getsckaddrport(&tcp->localaddr), buf2, mio_getsckaddrport(&tcp->remoteaddr));
}
else if (tcp->state & MIO_DEV_SCK_ACCEPTED)
{
printf ("DEVICE accepted client device... .LOCAL %s:%d REMOTE %s:%d\n", buf1, mio_getsckaddrport(&tcp->localaddr), buf2, mio_getsckaddrport(&tcp->remoteaddr));
}
return mio_dev_sck_write(tcp, "hello", 5, MIO_NULL, MIO_NULL);
if (mio_dev_sck_write(tcp, "hello", 5, MIO_NULL, MIO_NULL) <= -1)
{
mio_dev_sck_halt (tcp);
}
}
static int tcp_sck_on_write (mio_dev_sck_t* tcp, mio_iolen_t wrlen, void* wrctx, const mio_sckaddr_t* dstaddr)
@ -301,10 +302,9 @@ static int arp_sck_on_write (mio_dev_sck_t* dev, mio_iolen_t wrlen, void* wrctx,
return 0;
}
static int arp_sck_on_connect (mio_dev_sck_t* dev)
static void arp_sck_on_connect (mio_dev_sck_t* dev)
{
printf ("STARTING UP ARP SOCKET %d...\n", dev->sck);
return 0;
}
static void arp_sck_on_disconnect (mio_dev_sck_t* dev)

View File

@ -1105,7 +1105,7 @@ fcntl (rdev->sck, F_SETFL, flags | O_NONBLOCK);
ssl_connected:
#endif
MIO_DEV_SCK_SET_PROGRESS (rdev, MIO_DEV_SCK_CONNECTED);
if (rdev->on_connect(rdev) <= -1) return -1;
if (rdev->on_connect) rdev->on_connect (rdev);
#if defined(USE_SSL)
}
#endif
@ -1253,7 +1253,7 @@ static int harvest_outgoing_connection (mio_dev_sck_t* rdev)
ssl_connected:
#endif
MIO_DEV_SCK_SET_PROGRESS (rdev, MIO_DEV_SCK_CONNECTED);
if (rdev->on_connect (rdev) <= -1) return -1;
if (rdev->on_connect) rdev->on_connect (rdev);
#if defined(USE_SSL)
}
#endif
@ -1404,7 +1404,8 @@ accept_done:
else
{
MIO_DEV_SCK_SET_PROGRESS (clidev, MIO_DEV_SCK_ACCEPTED);
if (clidev->on_connect(clidev) <= -1) mio_dev_sck_halt (clidev);
/*if (clidev->on_connect(clidev) <= -1) mio_dev_sck_halt (clidev);*/
if (clidev->on_connect) clidev->on_connect (clidev);
}
return 0;
@ -1490,7 +1491,7 @@ static int dev_evcb_sck_ready_stateful (mio_dev_t* dev, int events)
}
MIO_DEV_SCK_SET_PROGRESS (rdev, MIO_DEV_SCK_CONNECTED);
if (rdev->on_connect (rdev) <= -1) return -1;
if (rdev->on_connect) rdev->on_connect (rdev);
return 0;
}
else
@ -1552,7 +1553,8 @@ static int dev_evcb_sck_ready_stateful (mio_dev_t* dev, int events)
}
MIO_DEV_SCK_SET_PROGRESS (rdev, MIO_DEV_SCK_ACCEPTED);
if (rdev->on_connect(rdev) <= -1) mio_dev_sck_halt (rdev);
/*if (rdev->on_connect(rdev) <= -1) mio_dev_sck_halt (rdev);*/
if (rdev->on_connect) rdev->on_connect (rdev);
return 0;
}

View File

@ -319,7 +319,7 @@ typedef void (*mio_dev_sck_on_disconnect_t) (
mio_dev_sck_t* dev
);
typedef int (*mio_dev_sck_on_connect_t) (
typedef void (*mio_dev_sck_on_connect_t) (
mio_dev_sck_t* dev
);