diff options
author | Mario Sergio Fujikawa Ferreira <lioux@FreeBSD.org> | 2007-05-26 11:58:32 +0000 |
---|---|---|
committer | Mario Sergio Fujikawa Ferreira <lioux@FreeBSD.org> | 2007-05-26 11:58:32 +0000 |
commit | 3093438e1db96dd2075af28b154518f9aadd1c83 (patch) | |
tree | 5a34b71bfb3ff0885b2ca0641c4a0a48e3297f3b /net | |
parent | Update to 0.43 (diff) |
o Improve error handling when processing files
o Add OPTIONS SO_KEEPALIVE and TCP_NODELAY
o Uphold hier(7) and install ccxstream under sbin/ instead of bin/
o Bump PORTREVISION
Notes
Notes:
svn path=/head/; revision=191897
Diffstat (limited to 'net')
-rw-r--r-- | net/ccxstream/Makefile | 40 | ||||
-rw-r--r-- | net/ccxstream/files/ccxstream.in (renamed from net/ccxstream/files/ccxstream.sh.sample) | 2 | ||||
-rw-r--r-- | net/ccxstream/files/patch-ccxclientconn.c | 14 | ||||
-rw-r--r-- | net/ccxstream/files/patch-ccxstream.c | 59 |
4 files changed, 99 insertions, 16 deletions
diff --git a/net/ccxstream/Makefile b/net/ccxstream/Makefile index f89f06d2338a..18352063085c 100644 --- a/net/ccxstream/Makefile +++ b/net/ccxstream/Makefile @@ -7,6 +7,7 @@ PORTNAME= ccxstream PORTVERSION= 1.0.15 +PORTREVISION= 1 CATEGORIES= net MASTER_SITES= ${MASTER_SITE_SOURCEFORGE} MASTER_SITE_SUBDIR= xbplayer @@ -14,28 +15,25 @@ MASTER_SITE_SUBDIR= xbplayer MAINTAINER= ports@FreeBSD.org COMMENT= Stream media files to XBox Media Center via XBMSP -USE_GMAKE= yes +OPTIONS= SO_KEEPALIVE "Build with SO_KEEPALIVE" ON \ + TCP_NODELAY "Build with TCP_NODELAY" OFF -USE_RC_SUBR= yes -RC_SCRIPTS_SUB= PREFIX=${PREFIX} RC_SUBR=${RC_SUBR} -SAMPLERC= ${PORTNAME}.sh.sample -REALRC= ${SAMPLERC:S/.sample//} +USE_GMAKE= yes +MAKE_ENV= CC="${CC}" +USE_RC_SUBR= ccxstream -PLIST_FILES= bin/ccxstream bin/ccxtest etc/rc.d/${REALRC} +PLIST_FILES= \ + bin/ccxtest \ + sbin/ccxstream .if !defined(NOPORTDOCS) PORTDOCS= README ChangeLog TODO xbmsp-xml.txt xbmsp.txt .endif -post-build: - @${SED} ${RC_SCRIPTS_SUB:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} \ - ${FILESDIR}/${SAMPLERC} > ${WRKDIR}/${SAMPLERC} - do-install: - @${MKDIR} ${PREFIX}/bin - @${INSTALL_PROGRAM} ${WRKSRC}/ccxstream ${PREFIX}/bin + @${MKDIR} ${PREFIX}/sbin + @${INSTALL_PROGRAM} ${WRKSRC}/ccxstream ${PREFIX}/sbin @${INSTALL_PROGRAM} ${WRKSRC}/ccxtest ${PREFIX}/bin - @${INSTALL_SCRIPT} ${WRKDIR}/${SAMPLERC} ${PREFIX}/etc/rc.d/${REALRC} .if !defined(NOPORTDOCS) @${MKDIR} ${DOCSDIR} .for i in ${PORTDOCS} @@ -44,6 +42,18 @@ do-install: .endif post-install: - @${CAT} pkg-message + @${CAT} ${PKGMESSAGE} + +.include <bsd.port.pre.mk> + +# enable SO_KEEPALIVE +.if defined(WITH_SO_KEEPALIVE) +CFLAGS+= -DSO_KEEPALIVE +.endif + +# enable TCP_NODELAY +.if defined(WITH_TCP_NODELAY) +CFLAGS+= -DTCP_NODELAY +.endif -.include <bsd.port.mk> +.include <bsd.port.post.mk> diff --git a/net/ccxstream/files/ccxstream.sh.sample b/net/ccxstream/files/ccxstream.in index 0782f1c0e740..7b68000d3e3b 100644 --- a/net/ccxstream/files/ccxstream.sh.sample +++ b/net/ccxstream/files/ccxstream.in @@ -31,7 +31,7 @@ name="ccxstream" rcvar=`set_rcvar` -command="%%PREFIX%%/bin/ccxstream" +command="%%PREFIX%%/sbin/ccxstream" load_rc_config "$name" : ${ccxstream_enable="NO"} diff --git a/net/ccxstream/files/patch-ccxclientconn.c b/net/ccxstream/files/patch-ccxclientconn.c new file mode 100644 index 000000000000..11e1ccb1f423 --- /dev/null +++ b/net/ccxstream/files/patch-ccxclientconn.c @@ -0,0 +1,14 @@ +--- ccxclientconn.c.orig Mon Mar 17 11:29:15 2003 ++++ ccxclientconn.c Tue May 15 14:58:52 2007 +@@ -51,6 +51,11 @@ + i = 1; + setsockopt(sock, IPPROTO_TCP,TCP_NODELAY, &i, sizeof (i)); + #endif /* TCP_NODELAY */ ++ ++#ifdef SO_KEEPALIVE ++ i = 1; ++ setsockopt(sock, SOL_SOCKET, SO_KEEPALIVE, &i, sizeof (i)); ++#endif /* SO_KEEPALIVE */ + } + + CcXstreamClientError cc_xstream_client_connect(const char *host, diff --git a/net/ccxstream/files/patch-ccxstream.c b/net/ccxstream/files/patch-ccxstream.c new file mode 100644 index 000000000000..4af51400cc14 --- /dev/null +++ b/net/ccxstream/files/patch-ccxstream.c @@ -0,0 +1,59 @@ +--- ccxstream.c.orig Mon Mar 17 11:29:15 2003 ++++ ccxstream.c Tue May 15 15:02:31 2007 +@@ -1004,7 +1004,7 @@ + for (fh = 0; fh < CC_XSTREAM_MAX_OPEN_FILES; fh++) + if (conn->open_file_handle[fh] == handle) + break; +- if (fh >= CC_XSTREAM_MAX_OPEN_FILES) ++ if ( (fh >= CC_XSTREAM_MAX_OPEN_FILES) || (conn->open_file_handle[fh] <= 0) ) + { + cc_xstream_send_error(conn, id, CC_XSTREAM_XBMSP_ERROR_INVALID_HANDLE, "Invalid file handle."); + return 1; +@@ -1016,10 +1016,19 @@ + } + hlp = cc_xmalloc(rlen); + sz = fread(hlp, 1, rlen, conn->f[fh]); ++ if ( (sz < rlen) && ( (ferror(conn->f[fh]) != 0) || (feof(conn->f[fh]) == 0) ) ) ++ { ++ fclose(conn->f[fh]); ++ conn->f[fh] = NULL; ++ cc_xstream_send_error(conn, id, CC_XSTREAM_XBMSP_ERROR_ILLEGAL_SEEK, "File read failed."); ++ } ++ else ++ { + cc_xstream_write_int(conn, 1 + 4 + 4 + sz); + cc_xstream_write_byte(conn, (int)CC_XSTREAM_XBMSP_PACKET_FILE_CONTENTS); + cc_xstream_write_int(conn, id); + cc_xstream_write_data_string(conn, (unsigned char *)hlp, sz); ++ } + cc_xfree(hlp); + return 1; + } +@@ -1661,6 +1670,16 @@ + setsockopt(prog->s, SOL_SOCKET, SO_REUSEPORT, (char *)&c, sizeof (c)); + #endif /* SO_REUSEPORT */ + ++#ifdef TCP_NODELAY ++ c = 1; ++ setsockopt(prog->s, IPPROTO_TCP, TCP_NODELAY, (char *)&c, sizeof (c)); ++#endif /* TCP_NODELAY */ ++ ++#ifdef SO_KEEPALIVE ++ c = 1; ++ setsockopt(prog->s, SOL_SOCKET, SO_KEEPALIVE, (char *)&c, sizeof (c)); ++#endif /* SO_KEEPALIVE */ ++ + memset(&sa, 0, sizeof (sa)); + sa.sin_family = AF_INET; + sa.sin_addr = la; +@@ -1693,6 +1712,10 @@ + c = 1; + setsockopt(prog->bs, SOL_SOCKET, SO_BROADCAST, (char *)&c, sizeof (c)); + #endif /* SO_BROADCAST */ ++#ifdef SO_KEEPALIVE ++ c = 1; ++ setsockopt(prog->bs, SOL_SOCKET, SO_KEEPALIVE, (char *)&c, sizeof (c)); ++#endif /* SO_KEEPALIVE */ + + memset(&sa, 0, sizeof (sa)); + sa.sin_family = AF_INET; |