mirror of
https://github.com/radareorg/radare2.git
synced 2024-12-01 00:51:19 +00:00
Co-authored-by: meme <meme@users.noreply.github.com>
This commit is contained in:
parent
797b937175
commit
36e9314832
@ -82,7 +82,7 @@ typedef struct r_socket_http_options {
|
|||||||
bool httpauth;
|
bool httpauth;
|
||||||
} RSocketHTTPOptions;
|
} RSocketHTTPOptions;
|
||||||
|
|
||||||
|
#define R_SOCKET_PROTO_DEFAULT 0
|
||||||
#define R_SOCKET_PROTO_TCP IPPROTO_TCP
|
#define R_SOCKET_PROTO_TCP IPPROTO_TCP
|
||||||
#define R_SOCKET_PROTO_UDP IPPROTO_UDP
|
#define R_SOCKET_PROTO_UDP IPPROTO_UDP
|
||||||
#define R_SOCKET_PROTO_UNIX 0x1337
|
#define R_SOCKET_PROTO_UNIX 0x1337
|
||||||
|
@ -496,6 +496,9 @@ R_API bool r_socket_listen(RSocket *s, const char *port, const char *certfile) {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
switch (s->proto) {
|
switch (s->proto) {
|
||||||
|
case R_SOCKET_PROTO_DEFAULT:
|
||||||
|
s->proto = R_SOCKET_PROTO_TCP;
|
||||||
|
/* fallthrough */
|
||||||
case R_SOCKET_PROTO_TCP:
|
case R_SOCKET_PROTO_TCP:
|
||||||
if ((s->fd = socket (AF_INET, SOCK_STREAM, R_SOCKET_PROTO_TCP)) == R_INVALID_SOCKET) {
|
if ((s->fd = socket (AF_INET, SOCK_STREAM, R_SOCKET_PROTO_TCP)) == R_INVALID_SOCKET) {
|
||||||
return false;
|
return false;
|
||||||
@ -507,7 +510,8 @@ R_API bool r_socket_listen(RSocket *s, const char *port, const char *certfile) {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
eprintf ("Invalid protocol for socket\n");
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
linger.l_onoff = 1;
|
linger.l_onoff = 1;
|
||||||
@ -550,6 +554,7 @@ R_API bool r_socket_listen(RSocket *s, const char *port, const char *certfile) {
|
|||||||
#endif
|
#endif
|
||||||
if (s->proto == R_SOCKET_PROTO_TCP) {
|
if (s->proto == R_SOCKET_PROTO_TCP) {
|
||||||
if (listen (s->fd, 32) < 0) {
|
if (listen (s->fd, 32) < 0) {
|
||||||
|
r_sys_perror ("listen");
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
closesocket (s->fd);
|
closesocket (s->fd);
|
||||||
#else
|
#else
|
||||||
|
Loading…
Reference in New Issue
Block a user