Synchronet now requires the libarchive development package (e.g. libarchive-dev on Debian-based Linux distros, libarchive.org for more info) to build successfully.

Commit 564a071e authored by rswindell's avatar rswindell
Browse files

Fix the "local_port" property for ListeningSocket(). Other properties that

depend on a socket descriptor still won't work.
parent 7cd6d1bf
...@@ -1989,7 +1989,9 @@ static JSBool js_socket_get(JSContext *cx, JSObject *obj, jsid id, jsval *vp) ...@@ -1989,7 +1989,9 @@ static JSBool js_socket_get(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
*vp=JSVAL_VOID; *vp=JSVAL_VOID;
break; break;
case SOCK_PROP_LOCAL_PORT: case SOCK_PROP_LOCAL_PORT:
if(p->sock != INVALID_SOCKET) { if(p->local_port != 0) {
*vp = INT_TO_JSVAL(p->local_port);
} else if(p->sock != INVALID_SOCKET) {
if(getsockname(p->sock, &addr.addr,&len)!=0) if(getsockname(p->sock, &addr.addr,&len)!=0)
return(JS_FALSE); return(JS_FALSE);
JS_RESUMEREQUEST(cx, rc); JS_RESUMEREQUEST(cx, rc);
...@@ -2847,6 +2849,7 @@ js_listening_socket_constructor(JSContext *cx, uintN argc, jsval *arglist) ...@@ -2847,6 +2849,7 @@ js_listening_socket_constructor(JSContext *cx, uintN argc, jsval *arglist)
p->network_byte_order = TRUE; p->network_byte_order = TRUE;
p->session=-1; p->session=-1;
p->unflushed = 0; p->unflushed = 0;
p->local_port = port;
if(!JS_SetPrivate(cx, obj, p)) { if(!JS_SetPrivate(cx, obj, p)) {
JS_ReportError(cx,"JS_SetPrivate failed"); JS_ReportError(cx,"JS_SetPrivate failed");
......
...@@ -24,6 +24,7 @@ typedef struct ...@@ -24,6 +24,7 @@ typedef struct
size_t unflushed; size_t unflushed;
char peeked_byte; char peeked_byte;
BOOL peeked; BOOL peeked;
uint16_t local_port;
} js_socket_private_t; } js_socket_private_t;
#ifdef __cplusplus #ifdef __cplusplus
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment