From: Andrea Zagli Date: Sat, 22 Aug 2015 13:14:19 +0000 (+0200) Subject: Wrong size of message sent. X-Git-Url: https://saetta.ns0.it/gitweb?a=commitdiff_plain;h=327a00f21a9f3d9ca7b5abc9d7b61c22b14633f6;p=libglib-mldonkey Wrong size of message sent. --- diff --git a/autogen.sh b/autogen.sh index 2bfbe7f..83f5de2 100755 --- a/autogen.sh +++ b/autogen.sh @@ -32,8 +32,10 @@ cd $olddir if [ "$NOCONFIGURE" = "" ]; then $srcdir/configure "$@" || exit 1 - if [ "$1" = "--help" ]; then exit 0 else - echo "Now type \`make\' to compile $PKG_NAME" || exit 1 + if [ "$1" = "--help" ]; then + exit 0 + else + echo "Now type \`make\' to compile $PKG_NAME" || exit 1 fi else echo "Skipping configure process." diff --git a/src/glib-mldonkey.c b/src/glib-mldonkey.c index 5ef94fa..eb1860e 100644 --- a/src/glib-mldonkey.c +++ b/src/glib-mldonkey.c @@ -354,7 +354,7 @@ glib_mldonkey_reply (GlibMldonkey *glibmldonkey, guint32 fopcode) { case 0: /* protocol version */ - buf32 = 4 + 2 + 4; + buf32 = 2 + 4; error = NULL; written = g_output_stream_write (priv->ostream, &buf32, @@ -400,7 +400,7 @@ glib_mldonkey_reply (GlibMldonkey *glibmldonkey, guint32 fopcode) guint16 lname = strlen (priv->username); guint16 lpassword = strlen (priv->password); - buf32 = 4 + 2 + 2 + lname + 2 + lpassword; + buf32 = 2 + 2 + lpassword + 2 + lname; error = NULL; written = g_output_stream_write (priv->ostream, &buf32, @@ -428,7 +428,7 @@ glib_mldonkey_reply (GlibMldonkey *glibmldonkey, guint32 fopcode) return; } - buf16 = lname; + buf16 = lpassword; error = NULL; written = g_output_stream_write (priv->ostream, &buf16, @@ -443,9 +443,10 @@ glib_mldonkey_reply (GlibMldonkey *glibmldonkey, guint32 fopcode) } error = NULL; - written = g_output_stream_write (priv->ostream, - &priv->username, - lname, + g_output_stream_write_all (priv->ostream, + priv->password, + lpassword, + &written, NULL, &error); if (written < 1 @@ -455,7 +456,7 @@ glib_mldonkey_reply (GlibMldonkey *glibmldonkey, guint32 fopcode) return; } - buf16 = lpassword; + buf16 = lname; error = NULL; written = g_output_stream_write (priv->ostream, &buf16, @@ -470,9 +471,10 @@ glib_mldonkey_reply (GlibMldonkey *glibmldonkey, guint32 fopcode) } error = NULL; - written = g_output_stream_write (priv->ostream, - &priv->password, - lpassword, + g_output_stream_write_all (priv->ostream, + priv->username, + lname, + &written, NULL, &error); if (written < 1