asyncsendto.c: use named enum.

see #502
This commit is contained in:
Thomas Bernard 2020-11-11 13:16:14 +01:00
parent 9793607a76
commit ab544c3a0e
No known key found for this signature in database
GPG Key ID: DB511043A31ACAAF
1 changed files with 6 additions and 4 deletions

View File

@ -1,7 +1,7 @@
/* $Id: asyncsendto.c,v 1.11 2019/09/24 11:46:01 nanard Exp $ */ /* $Id: asyncsendto.c,v 1.12 2020/11/11 12:13:26 nanard Exp $ */
/* MiniUPnP project /* MiniUPnP project
* http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/ * http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
* (c) 2006-2019 Thomas Bernard * (c) 2006-2020 Thomas Bernard
* This software is subject to the conditions detailed * This software is subject to the conditions detailed
* in the LICENCE file provided within the distribution */ * in the LICENCE file provided within the distribution */
@ -22,6 +22,8 @@
#include "asyncsendto.h" #include "asyncsendto.h"
#include "upnputils.h" #include "upnputils.h"
enum send_state {ESCHEDULED=1, EWAITREADY=2, ESENDNOW=3} state;
/* state diagram for a packet : /* state diagram for a packet :
* *
* | * |
@ -34,7 +36,7 @@
struct scheduled_send { struct scheduled_send {
LIST_ENTRY(scheduled_send) entries; LIST_ENTRY(scheduled_send) entries;
struct timeval ts; struct timeval ts;
enum {ESCHEDULED=1, EWAITREADY=2, ESENDNOW=3} state; enum send_state state;
int sockfd; int sockfd;
const void * buf; const void * buf;
size_t len; size_t len;
@ -96,7 +98,7 @@ sendto_schedule2(int sockfd, const void *buf, size_t len, int flags,
const struct sockaddr_in6 *src_addr, const struct sockaddr_in6 *src_addr,
unsigned int delay) unsigned int delay)
{ {
enum {ESCHEDULED, EWAITREADY, ESENDNOW} state; enum send_state state;
ssize_t n; ssize_t n;
size_t alloc_len; size_t alloc_len;
struct timeval tv; struct timeval tv;