Fix indent
This commit is contained in:
+6
-4
@@ -10,9 +10,11 @@
|
|||||||
int uc_set_nonblocking(int fd)
|
int uc_set_nonblocking(int fd)
|
||||||
{
|
{
|
||||||
int flags = fcntl(fd,F_GETFL,NULL);
|
int flags = fcntl(fd,F_GETFL,NULL);
|
||||||
|
|
||||||
if(flags < 0 ) {
|
if(flags < 0 ) {
|
||||||
return flags;
|
return flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
return fcntl(fd,F_SETFL,flags | O_NONBLOCK);
|
return fcntl(fd,F_SETFL,flags | O_NONBLOCK);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -30,7 +32,6 @@ int uc_set_reuseaddr(int sockfd)
|
|||||||
{
|
{
|
||||||
int opt = 1;
|
int opt = 1;
|
||||||
return setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, (char *)&opt, sizeof(opt));
|
return setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, (char *)&opt, sizeof(opt));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int uc_set_tcp_keepalive(int sockfd)
|
int uc_set_tcp_keepalive(int sockfd)
|
||||||
@@ -51,7 +52,6 @@ int uc_set_tcp_keepalive_cfg(int sockfd, const struct UCKeepConfig *cfg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//set the keepalive options
|
//set the keepalive options
|
||||||
|
|
||||||
rc = setsockopt(sockfd, SOL_TCP, TCP_KEEPCNT, &cfg->keepcnt, sizeof cfg->keepcnt);
|
rc = setsockopt(sockfd, SOL_TCP, TCP_KEEPCNT, &cfg->keepcnt, sizeof cfg->keepcnt);
|
||||||
if (rc != 0) {
|
if (rc != 0) {
|
||||||
return rc;
|
return rc;
|
||||||
@@ -70,7 +70,6 @@ int uc_set_tcp_keepalive_cfg(int sockfd, const struct UCKeepConfig *cfg)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int uc_set_send_timeout(int sockfd,long timeoutms)
|
int uc_set_send_timeout(int sockfd,long timeoutms)
|
||||||
{
|
{
|
||||||
struct timeval so_sndtimeo = {timeoutms/1000,(timeoutms%1000)*1000};
|
struct timeval so_sndtimeo = {timeoutms/1000,(timeoutms%1000)*1000};
|
||||||
@@ -85,15 +84,18 @@ int uc_set_receive_timeout(int sockfd,long timeoutms)
|
|||||||
return setsockopt(sockfd, SOL_SOCKET, SO_RCVTIMEO, &so_sndtimeo, sizeof(so_sndtimeo));
|
return setsockopt(sockfd, SOL_SOCKET, SO_RCVTIMEO, &so_sndtimeo, sizeof(so_sndtimeo));
|
||||||
}
|
}
|
||||||
|
|
||||||
int uc_set_ip_dscp(int fd, unsigned int dscp) {
|
int uc_set_ip_dscp(int fd, unsigned int dscp)
|
||||||
|
{
|
||||||
int val;
|
int val;
|
||||||
|
|
||||||
|
//only 6 bits for dscp
|
||||||
if (dscp > 63) {
|
if (dscp > 63) {
|
||||||
errno = EINVAL;
|
errno = EINVAL;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
val = dscp << 2;
|
val = dscp << 2;
|
||||||
|
|
||||||
return setsockopt(fd, IPPROTO_IP, IP_TOS, &val, sizeof val);
|
return setsockopt(fd, IPPROTO_IP, IP_TOS, &val, sizeof val);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user