Open GoogleCodeExporter opened 9 years ago
What steps will reproduce the problem? 1. jabber-net compiled with gmcs ver1.2.6.0 2. tor socks5 proxy 3. launch "mono Program.exe" What is the expected output? What do you see instead? SEND: <stream:stream xmlns:stream="http://etherx.jabber.org/streams" id="1568b3e5" xmlns="jabber:client" to="gmail.com" version="1.0"> RECV: <?xml version="1.0" encoding="UTF-8"?><stream:stream from="gmail.com" id="320F66EF3382104B" version="1.0" xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client"><stream:features><starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls"><required/></starttls><mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><mechanism>X-GOOGLE-TOKEN</mechanism></ mechanisms></stream:features> SEND: <starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls" /> RECV: <proceed xmlns="urn:ietf:params:xml:ns:xmpp-tls"/> Error: System.IO.IOException: The authentication or decryption has failed. ---> System.IO.IOException: Read failure ---> System.Net.Sockets.SocketException: Operation on non-blocking socket would block at System.Net.Sockets.Socket.Receive (System.Byte[] buf, Int32 offset, Int32 size, SocketFlags flags) [0x00000] at System.Net.Sockets.NetworkStream.Read (System.Byte[] buffer, Int32 offset, Int32 size) [0x00000] --- End of inner exception stack trace --- at System.Net.Sockets.NetworkStream.Read (System.Byte[] buffer, Int32 offset, Int32 size) [0x00000] at Mono.Security.Protocol.Tls.RecordProtocol.ReadStandardRecordBuffer (System.IO.Stream record) [0x00000] at Mono.Security.Protocol.Tls.RecordProtocol.ReadRecordBuffer (Int32 contentType, System.IO.Stream record) [0x00000] at Mono.Security.Protocol.Tls.RecordProtocol.InternalReceiveRecordCallback (IAsyncResult asyncResult) [0x00000] --- End of inner exception stack trace --- at Mono.Security.Protocol.Tls.SslStreamBase.AsyncHandshakeCallback (IAsyncResult asyncResult) [0x00000] Error: System.Exception: Unexpected exception ---> System.NullReferenceException: Object reference not set to an instance of an object at jabber.connection.XmppStream.SendNewStreamHeader () [0x00000] at jabber.connection.XmppStream.OnElement (System.Object sender, System.Xml.XmlElement tag) [0x00000] at jabber.client.JabberClient.OnElement (System.Object sender, System.Xml.XmlElement tag) [0x00000] at jabber.connection.XmppStream.jabber.connection.IStanzaEventListener.StanzaReceiv ed (System.Xml.XmlElement elem) [0x00000] at jabber.connection.SocketStanzaStream.m_elements_OnElement (System.Object sender, System.Xml.XmlElement rp) [0x00000] at jabber.protocol.ElementStream.FireOnElement (System.Xml.XmlElement elem) [0x00000] at jabber.protocol.AsynchElementStream.EndTag (System.Byte[] buf, Int32 offset, xpnet.ContentToken ct, TOK tok) [0x00000] at jabber.protocol.AsynchElementStream.Push (System.Byte[] buf, Int32 offset, Int32 length) [0x00000] --- End of inner exception stack trace --- at jabber.protocol.AsynchElementStream.Push (System.Byte[] buf, Int32 offset, Int32 length) [0x00000] at jabber.connection.SocketStanzaStream.bedrock.net.ISocketEventListener.OnRead (bedrock.net.BaseSocket sock, System.Byte[] buf, Int32 offset, Int32 length) [0x00000] What version of the product are you using? On what operating system? jabber-net 2.1.0.710 on Mandrivalinux 2008 Please provide any additional information below. Program.cs: /* * Created by SharpDevelop. * User: debe * Date: 20/09/2008 * Time: 16.39 * * To change this template use Tools | Options | Coding | Edit Standard Headers. */ #define DEBUG using System; using System.Threading; using jabber; using jabber.client; namespace AutmConferenceMono { class Program { // we will wait on this event until we're done sending static ManualResetEvent done = new ManualResetEvent(false); const string TARGET = "xxx@xxx.xxx"; static JabberClient j = new JabberClient(); static RosterManager rm= new RosterManager(); static PresenceManager pm = new PresenceManager(); static void Main(string[] args) { // what user/pass to log in as j.User = "user" j.Server = "gmail.com"; // use gmail.com for GoogleTalk j.Password = "password"; j.NetworkHost = "talk.l.google.com"; j.Port = 5222; //auth settings j.AutoStartTLS = true; //j.KeepAlive = 5; j.Resource = "resource"; //j.Priority = 24; //Proxy settings j.Proxy = jabber.connection.ProxyType.Socks5; j.ProxyHost = "127.0.0.1"; j.ProxyPort = 9050; // don't do extra stuff, please. j.AutoPresence = false; j.AutoRoster = true; j.AutoReconnect = 0; rm.Stream = j; pm.Stream = j; // listen for errors. Always do this! j.OnError += new bedrock.ExceptionHandler(j_OnError); // what to do when login completes j.OnAuthenticate += new bedrock.ObjectHandler(j_OnAuthenticate); //listen for message j.OnMessage += new MessageHandler(j_OnMessage); // listen for XMPP wire protocol #if DEBUG j.OnReadText += new bedrock.TextHandler(j_OnReadText); j.OnWriteText += new bedrock.TextHandler(j_OnWriteText); #endif //Per non farsi rompere i maroni col certificato!! j.OnInvalidCertificate += new System.Net.Security.RemoteCertificateValidationCallback(j_OnInvalidCertificate); // Set everything in motion j.Connect(); // wait until sending a message is complete done.WaitOne(); // logout cleanly j.Close(); //aspetta tutti i metodi... Thread.Sleep(3); } static void j_OnMessage(object sender, jabber.protocol.client.Message msg) { if (msg.Body.StartsWith("/quit")) { //� la fine done.Set(); } else if (msg.Body.StartsWith("/who")) { String WhoMsg = ""; foreach (JID user in rm) { if (pm.IsAvailable(user)) { jabber.protocol.client.Presence pres = pm[user]; // prendo il nome giusto String NomeUtente = rm[user.Bare].Nickname; if (NomeUtente == null) { //se non c'� il nickname uso il nome utente NomeUtente = user.Bare; } switch (pres.Show) { case "dnd": WhoMsg = WhoMsg + "*"+ NomeUtente + "*" + "\n"; break; case "away": WhoMsg = WhoMsg + "_"+ NomeUtente + "_" + "\n"; break; default: WhoMsg = WhoMsg + NomeUtente + "\n"; break; } } } j.Message(msg.From, WhoMsg); } else if (msg.Body.StartsWith("/status")) { //imposta la frase di stato del bot //la lunghezza di "/status" � 7 + 1 spazio String statusMsg = msg.Body.Remove(0, 8); j.Presence(jabber.protocol.client.PresenceType.available, statusMsg, "available", 0); } else { foreach (JID user in rm) { //se non sono quello che l'ha mandato if (user.ToString() != msg.From.Bare) { //ottengo il roster item che � pi� informativo jabber.protocol.iq.Item rosterItem = rm[user]; //tipo il nickname String FromUserName = rm[msg.From.Bare].Nickname; if (FromUserName == null) { //se non c'� il nickname uso il nome utente FromUserName = msg.From.User; } //il presence mi serve per sapere... jabber.protocol.client.Presence pres = pm[user]; //se l'utente � online if (pm.IsAvailable(user)) { //ok � disponibile //ma magari non vuole essere disturbato dnd = Do not disturb if (pres.Show != "dnd") { //message in a bottle! #if DEBUG j.Message(TARGET, "*" + FromUserName + ":* " + msg.Body + " to: " + user.Bare.ToString()); #else j.Message(user, "*" + FromUserName + ":* " + msg.Body); #endif } } else { //nulla } } } } } static bool j_OnInvalidCertificate(object sender, System.Security.Cryptography.X509Certificates.X509Certificate certificate, System.Security.Cryptography.X509Certificates.X509Chain chain, System.Net.Security.SslPolicyErrors sslPolicyErrors) { //Sono malato , ho il certificato! return true; } #if DEBUG static void j_OnWriteText(object sender, string txt) { if (txt == " ") return; // ignore keep-alive spaces Console.WriteLine("SEND: " + txt); } static void j_OnReadText(object sender, string txt) { if (txt == " ") return; // ignore keep-alive spaces Console.WriteLine("RECV: " + txt); } #endif static void j_OnAuthenticate(object sender) { //dico che sono online!! j.Presence(jabber.protocol.client.PresenceType.available, "conference Bot", "available", 0); } static void j_OnError(object sender, Exception ex) { // There was an error! Console.WriteLine("Error: " + ex.ToString()); // Shut down. done.Set(); } } }
Original issue reported on code.google.com by debe.mechero on 22 Sep 2008 at 11:03
debe.mechero
Original issue reported on code.google.com by
debe.mechero
on 22 Sep 2008 at 11:03