Guest User

Untitled

a guest
Jan 22nd, 2018
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.37 KB | None | 0 0
  1.  
  2. var nouvelle_conn;
  3. Step(
  4. function ha2() {
  5. if (client._path != null) {
  6. nouvelle_conn = tcp.createConnection(client._path);
  7. } else {
  8. nouvelle_conn = tcp.createConnection(client._port, client._host);
  9. }
  10. var self = this;
  11. sys.puts('end of ha 2');
  12. nouvelle_conn.on('connect', function() {
  13. nouvelle_conn.on('data', self);
  14. });
  15. },
  16. function ha3(err, d2, data) {
  17. nouvelle_conn.removeAllListeners('data');
  18. nouvelle_conn.setNoDelay(true);
  19. var decoder = data.toReader();
  20. status = decoder.int16();
  21. version = decoder.int16();
  22. len = decoder.int32();
  23.  
  24. console.log('connection to server version ' + version);
  25. if (version < 1) {
  26. err = new Error("Invalid Server version");
  27. throw(err);
  28. }
  29. var version_number = Buffer.makeWriter();
  30. version_number.push.int32(1);
  31. nouvelle_conn.write(version_number.toBuffer(), '', this);
  32. sys.puts('end of ha 3');
  33. },
  34. function ha4() {
  35. sys.puts('_connect: ' + sys.inspect(nouvelle_conn));
  36.  
  37. sys.puts('end of ha 4');
  38. return;
  39. }
  40. );
  41. sys.puts('out of step, at least');
Add Comment
Please, Sign In to add comment