|
|
|
@ -43,7 +43,8 @@ TR_socketAccept(TR_TcpSocket this) |
|
|
|
TR_Socket remote = TR_new(TR_TcpSocket, TR_socketLog(this), NULL, 0, 0); |
|
|
|
//int flags; |
|
|
|
|
|
|
|
remote->handle = accept( |
|
|
|
remote->addrlen = ((TR_Socket)this)->addrlen; |
|
|
|
remote->handle = accept( |
|
|
|
TR_socketHandle(this), |
|
|
|
(struct sockaddr *)&(remote->addr), |
|
|
|
&(remote->addrlen)); |
|
|
|
@ -51,14 +52,14 @@ TR_socketAccept(TR_TcpSocket this) |
|
|
|
//flags = fcntl(remote->handle, F_GETFL, 0); |
|
|
|
//fcntl(remote->handle, F_SETFL, flags | O_NONBLOCK); |
|
|
|
|
|
|
|
remote->host = TR_strdup(inet_ntoa(remote->addr.sin_addr)); |
|
|
|
remote->port = ntohs(remote->addr.sin_port); |
|
|
|
remote->type = TR_socketType(this); |
|
|
|
remote->flags = TR_socketFlags(this); |
|
|
|
|
|
|
|
if (-1 == remote->handle) { |
|
|
|
perror("accept"); |
|
|
|
TR_delete(remote); |
|
|
|
} else { |
|
|
|
remote->host = TR_strdup(inet_ntoa(remote->addr.sin_addr)); |
|
|
|
remote->port = ntohs(remote->addr.sin_port); |
|
|
|
remote->type = TR_socketType(this); |
|
|
|
remote->flags = TR_socketFlags(this); |
|
|
|
} |
|
|
|
|
|
|
|
return (TR_TcpSocket)remote; |
|
|
|
|