This allows us to send data in ssh_init(), albeit at the expense of its not
being properly logged, so arrange to send the version string then if that's
sensible, which should reduce the number of round-trips required to bring
up an SSH-2 connection.
git-svn-id: svn://svn.tartarus.org/sgt/putty@7646
cda61777-01e9-0310-a592-
d414129be87e
static int s_write(Ssh ssh, void *data, int len)
{
static int s_write(Ssh ssh, void *data, int len)
{
- log_packet(ssh->logctx, PKT_OUTGOING, -1, NULL, data, len, 0, NULL);
+ if (ssh->logctx)
+ log_packet(ssh->logctx, PKT_OUTGOING, -1, NULL, data, len, 0, NULL);
return sk_write(ssh->s, (char *)data, len);
}
return sk_write(ssh->s, (char *)data, len);
}
crBegin(ssh->do_ssh_init_crstate);
crBegin(ssh->do_ssh_init_crstate);
- /*
- * If the SSH version number's fixed, set it now, and if it's SSH-2,
- * send the version string too.
- *
- * XXX This isn't actually early enough to be useful, since we only
- * get here when the first incoming byte turns up.
- */
- if (ssh->cfg.sshprot == 0)
- ssh->version = 1;
- if (ssh->cfg.sshprot == 3) {
- ssh->version = 2;
- ssh_send_verstring(ssh, NULL);
- }
-
/* Search for a line beginning with the string "SSH-" in the input. */
for (;;) {
if (c != 'S') goto no;
/* Search for a line beginning with the string "SSH-" in the input. */
for (;;) {
if (c != 'S') goto no;
static void ssh_gotdata(Ssh ssh, unsigned char *data, int datalen)
{
/* Log raw data, if we're in that mode. */
static void ssh_gotdata(Ssh ssh, unsigned char *data, int datalen)
{
/* Log raw data, if we're in that mode. */
- log_packet(ssh->logctx, PKT_INCOMING, -1, NULL, data, datalen, 0, NULL);
+ if (ssh->logctx)
+ log_packet(ssh->logctx, PKT_INCOMING, -1, NULL, data, datalen,
+ 0, NULL);
crBegin(ssh->ssh_gotdata_crstate);
crBegin(ssh->ssh_gotdata_crstate);
+ /*
+ * If the SSH version number's fixed, set it now, and if it's SSH-2,
+ * send the version string too.
+ */
+ if (ssh->cfg.sshprot == 0)
+ ssh->version = 1;
+ if (ssh->cfg.sshprot == 3) {
+ ssh->version = 2;
+ ssh_send_verstring(ssh, NULL);
+ }
+