epoch fix
This commit is contained in:
parent
2279ad158e
commit
1bef2f2c68
3 changed files with 5 additions and 5 deletions
|
|
@ -42,7 +42,7 @@ int host_format(struct sockaddr *addr);
|
|||
int create_server(int port, int backlog, char *protoname);
|
||||
int create_client(char *addr, int port, char *protoname);
|
||||
void listener(int domain, int sock, int proto,
|
||||
void (*handler)(void *buf, int bytes, struct sockaddr_in *addr));
|
||||
void (*handler)(void *buf, int bytes, struct sockaddr *addr));
|
||||
|
||||
/*
|
||||
** lazy framing
|
||||
|
|
|
|||
|
|
@ -30,10 +30,10 @@ int create_client(char *addr, int port, char *protoname)
|
|||
}
|
||||
|
||||
void listener(int domain, int sock, int proto,
|
||||
void (*handler)(void *buf, int bytes, struct sockaddr_in *addr))
|
||||
void (*handler)(void *buf, int bytes, struct sockaddr *addr))
|
||||
{
|
||||
int sd;
|
||||
struct sockaddr_in addr;
|
||||
struct sockaddr addr;
|
||||
unsigned char buf[1024];
|
||||
int bytes;
|
||||
socklen_t len;
|
||||
|
|
@ -49,7 +49,7 @@ void listener(int domain, int sock, int proto,
|
|||
{
|
||||
bzero(buf, sizeof(buf));
|
||||
bytes = recvfrom(sd, buf, sizeof(buf), 0,
|
||||
(struct sockaddr*)&addr, &len);
|
||||
&addr, &len);
|
||||
if (bytes > 0 && handler)
|
||||
handler(buf, bytes, &addr);
|
||||
else
|
||||
|
|
|
|||
|
|
@ -27,5 +27,5 @@ double time_milli(void)
|
|||
|
||||
if (gettimeofday(&tv, NULL))
|
||||
return (0);
|
||||
return ((double)((double)tv.tv_sec / 1000. + tv.tv_usec * 1000.));
|
||||
return ((double)(tv.tv_sec * 1000. + (double)tv.tv_usec / 1000.));
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue