mirror of
https://github.com/transmission/transmission
synced 2025-03-03 10:15:45 +00:00
update miniupnp to 20090921
This commit is contained in:
parent
75a468a9e0
commit
ad019c6009
6 changed files with 61 additions and 20 deletions
5
third-party/miniupnp/Changelog.txt
vendored
5
third-party/miniupnp/Changelog.txt
vendored
|
@ -1,6 +1,9 @@
|
|||
$Id: Changelog.txt,v 1.90 2009/08/07 08:42:18 nanard Exp $
|
||||
$Id: Changelog.txt,v 1.91 2009/09/21 12:57:42 nanard Exp $
|
||||
miniUPnP client Changelog.
|
||||
|
||||
2009/09/21:
|
||||
fixing the code to ignore EINTR during connect() calls.
|
||||
|
||||
2009/08/07:
|
||||
Set socket timeout for connect()
|
||||
Some cleanup in miniwget.c
|
||||
|
|
3
third-party/miniupnp/minissdpc.c
vendored
3
third-party/miniupnp/minissdpc.c
vendored
|
@ -1,4 +1,4 @@
|
|||
/* $Id: minissdpc.c,v 1.9 2009/07/20 09:18:05 nanard Exp $ */
|
||||
/* $Id: minissdpc.c,v 1.10 2009/09/21 12:57:42 nanard Exp $ */
|
||||
/* Project : miniupnp
|
||||
* Author : Thomas BERNARD
|
||||
* copyright (c) 2005-2009 Thomas Bernard
|
||||
|
@ -53,6 +53,7 @@ getDevicesFromMiniSSDPD(const char * devtype, const char * socketpath)
|
|||
}
|
||||
addr.sun_family = AF_UNIX;
|
||||
strncpy(addr.sun_path, socketpath, sizeof(addr.sun_path));
|
||||
/* TODO : check if we need to handle the EINTR */
|
||||
if(connect(s, (struct sockaddr *)&addr, sizeof(struct sockaddr_un)) < 0)
|
||||
{
|
||||
/*syslog(LOG_WARNING, "connect(\"%s\"): %m", socketpath);*/
|
||||
|
|
34
third-party/miniupnp/miniupnpc.c
vendored
34
third-party/miniupnp/miniupnpc.c
vendored
|
@ -1,4 +1,4 @@
|
|||
/* $Id: miniupnpc.c,v 1.63 2009/08/07 14:44:50 nanard Exp $ */
|
||||
/* $Id: miniupnpc.c,v 1.64 2009/09/21 12:57:42 nanard Exp $ */
|
||||
/* Project : miniupnp
|
||||
* Author : Thomas BERNARD
|
||||
* copyright (c) 2005-2009 Thomas Bernard
|
||||
|
@ -263,12 +263,32 @@ int simpleUPnPcommand(int s, const char * url, const char * service,
|
|||
dest.sin_family = AF_INET;
|
||||
dest.sin_port = htons(port);
|
||||
dest.sin_addr.s_addr = inet_addr(hostname);
|
||||
n = connect(s, (struct sockaddr *)&dest, sizeof(struct sockaddr));
|
||||
#ifdef MINIUPNPC_IGNORE_EINTR
|
||||
do {
|
||||
#endif
|
||||
n = connect(s, (struct sockaddr *)&dest, sizeof(struct sockaddr));
|
||||
#ifdef MINIUPNPC_IGNORE_EINTR
|
||||
} while(n < 0 && errno == EINTR);
|
||||
while(n < 0 && errno == EINTR)
|
||||
{
|
||||
socklen_t len;
|
||||
fd_set wset;
|
||||
int err;
|
||||
FD_ZERO(&wset);
|
||||
FD_SET(s, &wset);
|
||||
if((n = select(s + 1, NULL, &wset, NULL, NULL)) == -1 && errno == EINTR)
|
||||
continue;
|
||||
/*len = 0;*/
|
||||
/*n = getpeername(s, NULL, &len);*/
|
||||
len = sizeof(err);
|
||||
if(getsockopt(s, SOL_SOCKET, SO_ERROR, &err, &len) < 0) {
|
||||
PRINT_SOCKET_ERROR("getsockopt");
|
||||
closesocket(s);
|
||||
return -1;
|
||||
}
|
||||
if(err != 0) {
|
||||
errno = err;
|
||||
n = -1;
|
||||
} else {
|
||||
n = 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if(n < 0)
|
||||
{
|
||||
|
@ -677,7 +697,7 @@ int ReceiveData(int socket, char * data, int length, int timeout)
|
|||
return n;
|
||||
}
|
||||
|
||||
static int
|
||||
int
|
||||
UPNPIGD_IsConnected(struct UPNPUrls * urls, struct IGDdatas * data)
|
||||
{
|
||||
char status[64];
|
||||
|
|
31
third-party/miniupnp/miniwget.c
vendored
31
third-party/miniupnp/miniwget.c
vendored
|
@ -1,4 +1,4 @@
|
|||
/* $Id: miniwget.c,v 1.25 2009/08/07 14:44:51 nanard Exp $ */
|
||||
/* $Id: miniwget.c,v 1.26 2009/09/21 12:57:42 nanard Exp $ */
|
||||
/* Project : miniupnp
|
||||
* Author : Thomas Bernard
|
||||
* Copyright (c) 2005-2009 Thomas Bernard
|
||||
|
@ -33,7 +33,6 @@
|
|||
#endif
|
||||
|
||||
#include "miniupnpcstrings.h"
|
||||
#include "miniwget.h"
|
||||
|
||||
/* miniwget2() :
|
||||
* */
|
||||
|
@ -85,12 +84,30 @@ miniwget2(const char * url, const char * host,
|
|||
#endif
|
||||
dest.sin_family = AF_INET;
|
||||
dest.sin_port = htons(port);
|
||||
n = connect(s, (struct sockaddr *)&dest, sizeof(struct sockaddr_in));
|
||||
#ifdef MINIUPNPC_IGNORE_EINTR
|
||||
do {
|
||||
#endif
|
||||
n = connect(s, (struct sockaddr *)&dest, sizeof(struct sockaddr_in));
|
||||
#ifdef MINIUPNPC_IGNORE_EINTR
|
||||
} while(n < 0 && errno == EINTR);
|
||||
while(n < 0 && errno == EINTR)
|
||||
{
|
||||
socklen_t len;
|
||||
fd_set wset;
|
||||
int err;
|
||||
FD_ZERO(&wset);
|
||||
FD_SET(s, &wset);
|
||||
if((n = select(s + 1, NULL, &wset, NULL, NULL)) == -1 && errno == EINTR)
|
||||
continue;
|
||||
/*len = 0;*/
|
||||
/*n = getpeername(s, NULL, &len);*/
|
||||
len = sizeof(err);
|
||||
if(getsockopt(s, SOL_SOCKET, SO_ERROR, &err, &len) < 0) {
|
||||
perror("getsockopt");
|
||||
closesocket(s);
|
||||
return NULL;
|
||||
}
|
||||
if(err != 0) {
|
||||
errno = err;
|
||||
n = -1;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if(n<0)
|
||||
{
|
||||
|
|
4
third-party/miniupnp/minixml.c
vendored
4
third-party/miniupnp/minixml.c
vendored
|
@ -35,7 +35,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
/* parseatt : used to parse the argument list
|
||||
* return 0 (false) in case of success and -1 (true) if the end
|
||||
* of the xmlbuffer is reached. */
|
||||
static int parseatt(struct xmlparser * p)
|
||||
int parseatt(struct xmlparser * p)
|
||||
{
|
||||
const char * attname;
|
||||
int attnamelen;
|
||||
|
@ -106,7 +106,7 @@ static int parseatt(struct xmlparser * p)
|
|||
|
||||
/* parseelt parse the xml stream and
|
||||
* call the callback functions when needed... */
|
||||
static void parseelt(struct xmlparser * p)
|
||||
void parseelt(struct xmlparser * p)
|
||||
{
|
||||
int i;
|
||||
const char * elementname;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#! /bin/sh
|
||||
# $Id: updateminiupnpcstrings.sh,v 1.3 2009/07/09 16:13:31 nanard Exp $
|
||||
# $Id: updateminiupnpcstrings.sh,v 1.4 2009/07/29 08:34:01 nanard Exp $
|
||||
|
||||
TEMPLATE_FILE=$1
|
||||
OUTPUT_FILE=$2
|
||||
|
@ -34,5 +34,5 @@ EXPR="s|OS_STRING \".*\"|OS_STRING \"${OS_NAME}/${OS_VERSION}\"|"
|
|||
#cp $OUTPUT_FILE $OUTPUT_FILE.bak
|
||||
test -f ${TEMPLATE_FILE}
|
||||
echo "setting OS_STRING macro value to ${OS_NAME}/${OS_VERSION} in $OUTPUT_FILE."
|
||||
sed "$EXPR" <"$TEMPLATE_FILE" >"$OUTPUT_FILE"
|
||||
sed -e "$EXPR" < $TEMPLATE_FILE > $OUTPUT_FILE
|
||||
|
||||
|
|
Loading…
Reference in a new issue