Skip to content

Commit 5f8f886

Browse files
author
bluenet13
committed
support to bind any ip for opendp stack
1 parent d058e94 commit 5f8f886

File tree

2 files changed

+17
-7
lines changed

2 files changed

+17
-7
lines changed

Diff for: redis.conf

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ tcp-backlog 511
6767
#
6868
# bind 192.168.1.100 10.0.0.1
6969
# bind 127.0.0.1
70-
bind 2.2.2.2
70+
#bind 2.2.2.2
7171

7272
# Specify the path for the Unix socket that will be used to listen for
7373
# incoming connections. There is no default, so Redis will not listen

Diff for: src/opendp_module.c

+16-6
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ int socket(int domain, int type, int protocol)
145145
{
146146
int rc;
147147

148-
ODP_FD_DEBUG("socket create start \n");
148+
ODP_FD_DEBUG("socket create start , domain %d, type %d \n", domain, type);
149149

150150
if ((inited == 0) || (AF_INET != domain) || (SOCK_STREAM != type && SOCK_DGRAM != type))
151151
{
@@ -323,7 +323,7 @@ ssize_t write(int fd, const void *buf, size_t count)
323323
{
324324
if(errno==NETDP_EAGAIN)
325325
{
326-
usleep(200); /* no space in netdp stack */
326+
// usleep(200); /* no space in netdp stack */
327327
continue;
328328
}
329329
else
@@ -335,7 +335,7 @@ ssize_t write(int fd, const void *buf, size_t count)
335335

336336
if (nwrite < n)
337337
{
338-
usleep(200);/* no space in netdp stack */
338+
// usleep(200);/* no space in netdp stack */
339339
}
340340
n -= nwrite;
341341

@@ -556,9 +556,9 @@ int accept4(int sockfd, struct sockaddr *addr, socklen_t *addrlen, int flags)
556556
*/
557557
int shutdown (int fd, int how)
558558
{
559-
if (netdpsock_check(fd))
559+
if (fd > ODP_FD_BASE)
560560
{
561-
// fd &= ~(1 << ODP_FD_BITS);
561+
fd -= ODP_FD_BASE;
562562
//netdpsock_close(fd);
563563
return 0;
564564
}
@@ -642,14 +642,24 @@ int epoll_ctl(int epfd, int op, int fd, struct epoll_event *event)
642642

643643
if (epfd > ODP_FD_BASE)
644644
{
645+
if(fd <= ODP_FD_BASE)
646+
{
647+
printf("skip linux fd %d \n", fd);
648+
return 0;
649+
}
645650
epfd -= ODP_FD_BASE;
646651
fd -= ODP_FD_BASE;
647652

648653
rc = netdpsock_epoll_ctl(epfd, op, fd, event);
649654
}
650655
else
651656
{
652-
// assert(!(__fd & (1 << ODP_FD_BITS)));
657+
if(fd > ODP_FD_BASE)
658+
{
659+
printf("skip netdp fd %d \n", fd);
660+
return 0;
661+
}
662+
653663
rc = real_epoll_ctl(epfd, op, fd, event);
654664
}
655665
return rc;

0 commit comments

Comments
 (0)