Commit d5070d79 authored by Ian Craggs's avatar Ian Craggs

Fix ant build & test plus some compiler warnings

Squashed commit of the following:

commit 42ff91b70ebc9719048c1676548683cdabfaa433
Author: Ian Craggs <icraggs@uk.ibm.com>
Date:   Thu Jun 29 10:38:20 2017 +0100

    Proxy ports

commit c7cb7c1372796d26fd09cc9d8a098fd96e0d00d2
Author: Ian Craggs <icraggs@uk.ibm.com>
Date:   Wed Jun 28 19:46:19 2017 +0100

    Fix build.xml syntax

commit 371565969967a2bbad9965ec87019c57f63beb5f
Author: Ian Craggs <icraggs@uk.ibm.com>
Date:   Wed Jun 28 19:45:05 2017 +0100

    Fix mqttsas2 invocation

commit ec2d18d37c533d4df3a56cc5d28feb3334259d62
Author: Ian Craggs <icraggs@uk.ibm.com>
Date:   Wed Jun 28 19:34:10 2017 +0100

    Change broker port to allow proxy to start on Hudson
parent 6b0502d1
<!--**************************************************************************** <!--****************************************************************************
Copyright (c) 2012, 2016 IBM Corp. Copyright (c) 2012, 2017 IBM Corp.
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are made available under the terms of the Eclipse Public License v1.0 are made available under the terms of the Eclipse Public License v1.0
and Eclipse Distribution License v1.0 which accompany this distribution. and Eclipse Distribution License v1.0 which accompany this distribution.
The Eclipse Public License is available at The Eclipse Public License is available at
http://www.eclipse.org/legal/epl-v10.html http://www.eclipse.org/legal/epl-v10.html
and the Eclipse Distribution License is available at and the Eclipse Distribution License is available at
http://www.eclipse.org/org/documents/edl-v10.php. http://www.eclipse.org/org/documents/edl-v10.php.
Contributors: Contributors:
Ian Craggs - initial API and implementation and/or initial documentation Ian Craggs - initial API and implementation and/or initial documentation
*******************************************************************************--> *******************************************************************************-->
...@@ -23,8 +23,8 @@ ...@@ -23,8 +23,8 @@
</classpath> </classpath>
</taskdef> </taskdef>
<property name="output.folder" value="build/output" /> <property name="output.folder" value="build/output" />
<property name="release.version" value="1.1.0" /> <property name="release.version" value="1.2.0" />
<property name="libname" value="mqttv3c" /> <property name="libname" value="mqttv3c" />
<property name="libname.ssl" value="mqttv3cs" /> <property name="libname.ssl" value="mqttv3cs" />
...@@ -33,7 +33,8 @@ ...@@ -33,7 +33,8 @@
<property name="ssl" value="yes" /> <property name="ssl" value="yes" />
<property name="windows.openssl.folder" value="c:\openssl\bin" /> <property name="windows.openssl.folder" value="c:\openssl\bin" />
<property name="test.hostname" value="iot.eclipse.org"/> <property name="test.hostname" value="iot.eclipse.org"/>
<property name="test.port" value="18883"/> <property name="test.port" value="1883"/>
<property name="proxy.port" value="18883"/>
<if> <if>
<os family="windows"/> <os family="windows"/>
<then> <then>
...@@ -52,7 +53,7 @@ ...@@ -52,7 +53,7 @@
</else> </else>
</if> </if>
<echo message="os.family is '${os.family}'" /> <echo message="os.family is '${os.family}'" />
<target name="init"> <target name="init">
<tstamp> <tstamp>
<format property="buildTimestamp" pattern="yyyyMMddHHmm" /> <format property="buildTimestamp" pattern="yyyyMMddHHmm" />
...@@ -73,22 +74,24 @@ ...@@ -73,22 +74,24 @@
<pathconvert refid="async.source.fileset" property="async.source.files" pathsep=" "/> <pathconvert refid="async.source.fileset" property="async.source.files" pathsep=" "/>
</target> </target>
<target name="version" depends="init" description="replace tags with the right levels"> <target name="version" depends="init" description="replace tags with the right levels">
<property name="build.level" value="${DSTAMP}${TSTAMP}" /> <property name="build.level" value="${DSTAMP}${TSTAMP}" />
<copy file="src/VersionInfo.h.in" tofile="src/VersionInfo.h" /> <copy file="src/VersionInfo.h.in" tofile="src/VersionInfo.h" />
<replace file="src/VersionInfo.h" token="@BUILD_TIMESTAMP@" value="${build.level}" /> <replace file="src/VersionInfo.h" token="@BUILD_TIMESTAMP@" value="${build.level}" />
<replace file="src/VersionInfo.h" token="@CLIENT_VERSION@" value="${release.version}" /> <replace file="src/VersionInfo.h" token="@CLIENT_VERSION@" value="${release.version}" />
</target> </target>
<target name="test" > <target name="test" >
<!-- display Python version --> <!-- display Python version -->
<exec executable="python" failonerror="true"> <exec executable="python" failonerror="true">
<arg line="-V"/> <arg line="-V"/>
</exec> </exec>
<exec executable="python" dir="test" spawn="true"> <exec executable="python" dir="test" spawn="true">
<arg value="mqttsas2.py" /> <arg value="mqttsas2.py" />
<arg value="${test.hostname}" /> <arg value="${test.hostname}" />
<arg value="${test.port}" />
<arg value="${proxy.port}" />
</exec> </exec>
<if> <if>
<os family="windows"/> <os family="windows"/>
...@@ -105,19 +108,23 @@ ...@@ -105,19 +108,23 @@
<target name="runAtest"> <target name="runAtest">
<if> <if>
<os family="windows"/> <os family="windows"/>
<then> <then>
<exec executable="cmd.exe" failonerror="true" dir="${output.folder}/test" > <exec executable="cmd.exe" failonerror="true" dir="${output.folder}/test" >
<arg value="/c" /> <arg value="/c" />
<arg value="${aTest}.exe" /> <arg value="${aTest}.exe" />
<arg value="--connection" /> <arg value="--connection" />
<arg value="tcp://${test.hostname}:${test.port}" /> <arg value="tcp://${test.hostname}:${test.port}" />
<arg value="--proxy_connection" />
<arg value="tcp://localhost:${proxy.port}" />
<env key="PATH" path="${output.folder}" /> <env key="PATH" path="${output.folder}" />
</exec> </exec>
</then> </then>
<else> <else>
<exec executable="./${aTest}" failonerror="true" dir="${output.folder}/test" > <exec executable="./${aTest}" failonerror="true" dir="${output.folder}/test" >
<arg value="--connection" /> <arg value="--connection" />
<arg value="tcp://${test.hostname}:1883" /> <arg value="tcp://${test.hostname}:${test.port}" />
<arg value="--proxy_connection" />
<arg value="tcp://localhost:${proxy.port}" />
<env key="LD_LIBRARY_PATH" path="${output.folder}" /> <env key="LD_LIBRARY_PATH" path="${output.folder}" />
<env key="DYLD_LIBRARY_PATH" path="${output.folder}" /> <env key="DYLD_LIBRARY_PATH" path="${output.folder}" />
</exec> </exec>
...@@ -128,8 +135,8 @@ ...@@ -128,8 +135,8 @@
<target name="runSSLtest"> <target name="runSSLtest">
<if> <if>
<os family="windows"/> <os family="windows"/>
<then> <then>
<exec executable="cmd.exe" failonerror="true" dir="${output.folder}/test" > <exec executable="cmd.exe" failonerror="true" dir="${output.folder}/test" >
<arg value="/c" /> <arg value="/c" />
<arg value="${aTest}.exe" /> <arg value="${aTest}.exe" />
<arg value="--hostname" /> <arg value="--hostname" />
...@@ -137,8 +144,8 @@ ...@@ -137,8 +144,8 @@
<env key="PATH" path="${output.folder};${windows.openssl.folder}" /> <env key="PATH" path="${output.folder};${windows.openssl.folder}" />
</exec> </exec>
</then> </then>
<else> <else>
<exec executable="./${aTest}" failonerror="true" dir="${output.folder}/test" > <exec executable="./${aTest}" failonerror="true" dir="${output.folder}/test" >
<arg value="--hostname" /> <arg value="--hostname" />
<arg value="${test.hostname}" /> <arg value="${test.hostname}" />
<env key="LD_LIBRARY_PATH" path="${output.folder}" /> <env key="LD_LIBRARY_PATH" path="${output.folder}" />
...@@ -161,10 +168,10 @@ ...@@ -161,10 +168,10 @@
</exec> </exec>
<zip destfile="${output.folder}/MQTTClient_doc.zip"> <zip destfile="${output.folder}/MQTTClient_doc.zip">
<zipfileset dir="${output.folder}/doc/MQTTClient" /> <zipfileset dir="${output.folder}/doc/MQTTClient" />
</zip> </zip>
<zip destfile="${output.folder}/MQTTAsync_doc.zip"> <zip destfile="${output.folder}/MQTTAsync_doc.zip">
<zipfileset dir="${output.folder}/doc/MQTTAsync" prefix="MQTTAsync/"/> <zipfileset dir="${output.folder}/doc/MQTTAsync" prefix="MQTTAsync/"/>
</zip> </zip>
<delete dir="${output.folder}/doc" /> <delete dir="${output.folder}/doc" />
</then> </then>
<else> <else>
...@@ -176,11 +183,11 @@ ...@@ -176,11 +183,11 @@
<target name="build" > <target name="build" >
<if> <if>
<os family="unix"/> <os family="unix"/>
<then> <then>
<delete dir="${output.folder}" /> <delete dir="${output.folder}" />
<!-- display gcc version --> <!-- display gcc version -->
<exec executable="gcc" failonerror="true"> <exec executable="gcc" failonerror="true">
<arg line="-v"/> <arg line="-v"/>
</exec> </exec>
<if> <if>
<available file="/usr/bin/make"/> <available file="/usr/bin/make"/>
...@@ -192,7 +199,7 @@ ...@@ -192,7 +199,7 @@
</if> </if>
<if> <if>
<os family="windows"/> <os family="windows"/>
<then> <then>
<delete dir="${output.folder}" /> <delete dir="${output.folder}" />
<!-- display gcc version --> <!-- display gcc version -->
<exec executable="cl" failonerror="true"> <exec executable="cl" failonerror="true">
...@@ -209,7 +216,7 @@ ...@@ -209,7 +216,7 @@
<mkdir dir="${output.folder}/include"/> <mkdir dir="${output.folder}/include"/>
<copy overwrite="true" todir="${output.folder}/include"> <copy overwrite="true" todir="${output.folder}/include">
<fileset dir="src" includes="MQTTClient.h,MQTTAsync.h,MQTTClientPersistence.h"/> <fileset dir="src" includes="MQTTClient.h,MQTTAsync.h,MQTTClientPersistence.h"/>
</copy> </copy>
<copy overwrite="true" todir="${output.folder}"> <copy overwrite="true" todir="${output.folder}">
<fileset dir="." includes="README.md,CONTRIBUTING.md,about.html,notice.html,edl-v10,epl-v10"/> <fileset dir="." includes="README.md,CONTRIBUTING.md,about.html,notice.html,edl-v10,epl-v10"/>
</copy> </copy>
...@@ -224,7 +231,7 @@ ...@@ -224,7 +231,7 @@
</move> </move>
<copy overwrite="true" todir="${output.folder}/samples"> <copy overwrite="true" todir="${output.folder}/samples">
<fileset dir="src/samples" includes="*"/> <fileset dir="src/samples" includes="*"/>
</copy> </copy>
<delete> <delete>
<fileset dir="." includes="eclipse-paho-mqtt-c-windows-${release.version}.zip"/> <fileset dir="." includes="eclipse-paho-mqtt-c-windows-${release.version}.zip"/>
<fileset dir="." includes="eclipse-paho-mqtt-c-${os.family}-${release.version}.tar.gz"/> <fileset dir="." includes="eclipse-paho-mqtt-c-${os.family}-${release.version}.tar.gz"/>
...@@ -263,7 +270,7 @@ ...@@ -263,7 +270,7 @@
<arg value="lib"/> <arg value="lib"/>
<arg value="bin"/> <arg value="bin"/>
</exec> </exec>
</else> </else>
</if> </if>
<if> <if>
...@@ -284,7 +291,7 @@ ...@@ -284,7 +291,7 @@
<arg value="test"/> <arg value="test"/>
<arg value="Windows Build"/> <arg value="Windows Build"/>
</exec> </exec>
</then> </then>
</if> </if>
</target> </target>
...@@ -299,7 +306,7 @@ ...@@ -299,7 +306,7 @@
<include name="*.gz"/> <include name="*.gz"/>
<include name="*.zip"/> <include name="*.zip"/>
</fileset> </fileset>
</copy> </copy>
</then> </then>
</if> </if>
</target> </target>
...@@ -307,4 +314,3 @@ ...@@ -307,4 +314,3 @@
<target name="full" depends="init, version, build, test, doc, package, copy" /> <target name="full" depends="init, version, build, test, doc, package, copy" />
</project> </project>
...@@ -286,7 +286,7 @@ static int MQTTClient_disconnect_internal(MQTTClient handle, int timeout); ...@@ -286,7 +286,7 @@ static int MQTTClient_disconnect_internal(MQTTClient handle, int timeout);
static void MQTTClient_retry(void); static void MQTTClient_retry(void);
static MQTTPacket* MQTTClient_cycle(int* sock, unsigned long timeout, int* rc); static MQTTPacket* MQTTClient_cycle(int* sock, unsigned long timeout, int* rc);
static MQTTPacket* MQTTClient_waitfor(MQTTClient handle, int packet_type, int* rc, long timeout); static MQTTPacket* MQTTClient_waitfor(MQTTClient handle, int packet_type, int* rc, long timeout);
static int pubCompare(void* a, void* b); /*static int pubCompare(void* a, void* b); */
static void MQTTProtocol_checkPendingWrites(void); static void MQTTProtocol_checkPendingWrites(void);
static void MQTTClient_writeComplete(int socket); static void MQTTClient_writeComplete(int socket);
...@@ -1922,12 +1922,12 @@ exit: ...@@ -1922,12 +1922,12 @@ exit:
FUNC_EXIT; FUNC_EXIT;
} }
/*
static int pubCompare(void* a, void* b) static int pubCompare(void* a, void* b)
{ {
Messages* msg = (Messages*)a; Messages* msg = (Messages*)a;
return msg->publish == (Publications*)b; return msg->publish == (Publications*)b;
} }*/
int MQTTClient_waitForCompletion(MQTTClient handle, MQTTClient_deliveryToken mdt, unsigned long timeout) int MQTTClient_waitForCompletion(MQTTClient handle, MQTTClient_deliveryToken mdt, unsigned long timeout)
......
...@@ -219,7 +219,7 @@ int Thread_wait_sem(sem_type sem, int timeout) ...@@ -219,7 +219,7 @@ int Thread_wait_sem(sem_type sem, int timeout)
* so I've used trywait in a loop instead. Ian Craggs 23/7/2010 * so I've used trywait in a loop instead. Ian Craggs 23/7/2010
*/ */
int rc = -1; int rc = -1;
#if !defined(WIN32) && !defined(WIN64) #if !defined(WIN32) && !defined(WIN64) && !defined(OSX)
#define USE_TRYWAIT #define USE_TRYWAIT
#if defined(USE_TRYWAIT) #if defined(USE_TRYWAIT)
int i = 0; int i = 0;
......
...@@ -106,10 +106,13 @@ def run(): ...@@ -106,10 +106,13 @@ def run():
else: else:
brokerport = 1883 brokerport = 1883
if brokerhost == myhost: if len(sys.argv) > 3:
myport = brokerport + 1 myport = int(sys.argv[3])
else: else:
myport = 1883 if brokerhost == myhost:
myport = brokerport + 1
else:
myport = 1883
print("Listening on port", str(myport)+", broker on port", brokerport) print("Listening on port", str(myport)+", broker on port", brokerport)
s = ThreadingTCPServer(("127.0.0.1", myport), MyHandler) s = ThreadingTCPServer(("127.0.0.1", myport), MyHandler)
......
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