[Ttssh2-commit] [7953] SCPファイル受信をブロック解除する処理を共通化し、受信をキャンセルした場合にも

Back to archive index
scmno****@osdn***** scmno****@osdn*****
2019年 8月 14日 (水) 12:40:49 JST


Revision: 7953
          https://osdn.net/projects/ttssh2/scm/svn/commits/7953
Author:   yutakapon
Date:     2019-08-14 12:40:48 +0900 (Wed, 14 Aug 2019)
Log Message:
-----------
SCPファイル受信をブロック解除する処理を共通化し、受信をキャンセルした場合にも
ブロック解除するようにした。
#34056

Ticket Links:
------------
    https://osdn.net/projects/ttssh2/tracker/detail/34056

Modified Paths:
--------------
    branches/scp_flowctrl/ttssh2/ttxssh/pkt.c
    branches/scp_flowctrl/ttssh2/ttxssh/ssh.c

-------------- next part --------------
Modified: branches/scp_flowctrl/ttssh2/ttxssh/pkt.c
===================================================================
--- branches/scp_flowctrl/ttssh2/ttxssh/pkt.c	2019-08-13 16:22:11 UTC (rev 7952)
+++ branches/scp_flowctrl/ttssh2/ttxssh/pkt.c	2019-08-14 03:40:48 UTC (rev 7953)
@@ -273,10 +273,8 @@
 				return amount_in_buf;
 
 			}
-			else {
-				amount_read = recv_data(pvar, READAMOUNT);
 
-			}
+			amount_read = recv_data(pvar, READAMOUNT);
 
 			if (amount_read == SOCKET_ERROR) {
 				if (amount_in_buf == 0) {

Modified: branches/scp_flowctrl/ttssh2/ttxssh/ssh.c
===================================================================
--- branches/scp_flowctrl/ttssh2/ttxssh/ssh.c	2019-08-13 16:22:11 UTC (rev 7952)
+++ branches/scp_flowctrl/ttssh2/ttxssh/ssh.c	2019-08-14 03:40:48 UTC (rev 7953)
@@ -139,6 +139,7 @@
 static void ssh2_scp_get_packetlist(PTInstVar pvar, Channel_t *c, unsigned char **buf, unsigned int *buflen);
 static void ssh2_scp_free_packetlist(PTInstVar pvar, Channel_t *c);
 static void get_window_pixel_size(PTInstVar pvar, int *x, int *y);
+static void ssh2_scp_recv_unblocked(PTInstVar pvar);
 
 // \x83}\x83N\x83\x8D
 #define remained_payload(pvar) ((pvar)->ssh_state.payload + payload_current_offset(pvar))
@@ -222,7 +223,6 @@
 		c->scp.localfp = NULL;
 		c->scp.filemtime = 0;
 		c->scp.fileatime = 0;
-		c->scp.pvar = NULL;
 	}
 	if (type == TYPE_AGENT) {
 		c->agent_msg = buffer_init();
@@ -2879,7 +2879,6 @@
 	pvar->agentfwd_enable = FALSE;
 	pvar->use_subsystem = FALSE;
 	pvar->nosession = FALSE;
-	pvar->recv_suspended = FALSE;
 
 }
 
@@ -8189,6 +8188,10 @@
 			{
 			scp_dlg_parm_t *parm = (scp_dlg_parm_t *)wp;
 
+			// SCP\x82̎\xF3\x90M\x8F\x88\x97\x9D\x82𒆒f\x82\xB5\x82\xBD\x8Fꍇ\x82ɂ\xE0\x81Arecv()\x82̃u\x83\x8D\x83b\x83N\x82\xF0\x89\xF0\x8F\x9C\x82\xB7\x82\xE9\x81B
+			// \x82\xB1\x82\xEA\x82\xF0\x82\xE2\x82\xE7\x82Ȃ\xA2\x82ƁATera Term\x82\xAA\x8Cł܂\xC1\x82\xBD\x82܂܂ɂȂ\xC1\x82Ă\xB5\x82܂\xA4\x81B
+			ssh2_scp_recv_unblocked(parm->pvar);
+
 			ssh2_channel_send_close(parm->pvar, parm->c);
 			}
 			return TRUE;
@@ -8558,10 +8561,6 @@
 	ShowWindow(c->scp.progress_window, SW_HIDE);
 
 cancel_abort:
-	// SCP\x82̎\xF3\x90M\x8F\x88\x97\x9D\x82\xAA\x8FI\x97\xB9\x82\xB5\x82\xBD\x8Fꍇ\x82́Arecv()\x82̃u\x83\x8D\x83b\x83N\x82\xF0\x89\xF0\x8F\x9C\x82\xB7\x82\xE9\x81B
-	// \x82\xB1\x82\xEA\x82\xF0\x82\xE2\x82\xE7\x82Ȃ\xA2\x82ƁATera Term\x82\xAA\x8Cł܂\xC1\x82\xBD\x82܂܂ɂȂ\xC1\x82Ă\xB5\x82܂\xA4\x81B
-	pvar->recv_suspended = FALSE;
-
 	// \x83`\x83\x83\x83l\x83\x8B\x82̃N\x83\x8D\x81[\x83Y\x82\xF0\x8Ds\x82\xA2\x82\xBD\x82\xA2\x82\xAA\x81A\x92\xBC\x90\xDA ssh2_channel_send_close() \x82\xF0\x8CĂяo\x82\xB7\x82ƁA
 	// \x93\x96\x8AY\x8A֐\x94\x82\xAA\x83X\x83\x8C\x83b\x83h\x83Z\x81[\x83t\x82ł͂Ȃ\xA2\x82\xBD\x82߁ASCP\x8F\x88\x97\x9D\x82\xAA\x90\xB3\x8F\xED\x82ɏI\x97\xB9\x82\xB5\x82Ȃ\xA2\x8Fꍇ\x82\xAA\x82\xA0\x82\xE9\x81B
 	// (2011.6.1 yutaka)
@@ -8572,6 +8571,18 @@
 	return 0;
 }
 
+// SCP\x83t\x83@\x83C\x83\x8B\x8E\xF3\x90M\x8F\x88\x97\x9D\x92\x86\x82\xC9 recv \x82\xF0\x83u\x83\x8D\x83b\x83N\x82\xB5\x82Ă\xA2\x82\xE9\x8Fꍇ\x82́A\x83u\x83\x8D\x83b\x83N\x82\xF0\x89\xF0\x8F\x9C\x82\xB7\x82\xE9\x81B
+static void ssh2_scp_recv_unblocked(PTInstVar pvar)
+{
+	// \x83u\x83\x8D\x83b\x83N\x82\xB5\x82Ă\xA2\x82\xE9\x8Fꍇ
+	if (pvar->recv_suspended) {
+		// recv()\x82̃u\x83\x8D\x83b\x83N\x82\xF0\x89\xF0\x8F\x9C\x82\xB7\x82\xE9\x81B
+		pvar->recv_suspended = FALSE;
+		// FD_READ\x83\x81\x83b\x83Z\x81[\x83W\x82𓊂\xB0\x82\xC4 recv() \x82̍ĊJ\x82𑣂\xB7\x81B
+		PostMessage(pvar->NotificationWindow, WM_USER_COMMNOTIFY, pvar->socket, MAKELPARAM(FD_READ, 0));
+	}
+}
+
 // SSH\x83T\x81[\x83o\x82\xA9\x82瑗\x82\xE7\x82\xEA\x82Ă\xAB\x82\xBD\x83t\x83@\x83C\x83\x8B\x82̃f\x81[\x83^\x82\xF0\x83\x8A\x83X\x83g\x82ɂ‚Ȃ\xAE\x81B
 // \x83\x8A\x83X\x83g\x82̎\xE6\x82\xE8\x8Fo\x82\xB5\x82\xCD ssh_scp_receive_thread \x83X\x83\x8C\x83b\x83h\x82ōs\x82\xA4\x81B
 static void ssh2_scp_add_packetlist(PTInstVar pvar, Channel_t *c, unsigned char *buf, unsigned int buflen)
@@ -8652,11 +8663,7 @@
 	// SSH\x83T\x81[\x83o\x82\xA9\x82\xE7\x82̎\xF3\x90M\x82\xF0\x8DĊJ\x82\xB7\x82\xE9\x82悤\x82Ɏw\x8E\xA6\x82\xF0\x8Fo\x82\xB7\x81B
 	if (c->scp.pktlist_cursize <= SCPRCV_LOW_WATER_MARK) {
 		// recv()\x82̃u\x83\x8D\x83b\x83N\x82\xF0\x89\xF0\x8F\x9C\x82\xB7\x82\xE9\x81B
-		if (pvar->recv_suspended) {
-			pvar->recv_suspended = FALSE;
-			// FD_READ\x83\x81\x83b\x83Z\x81[\x83W\x82𓊂\xB0\x82\xC4 recv() \x82̍ĊJ\x82𑣂\xB7\x81B
-			PostMessage(pvar->NotificationWindow, WM_USER_COMMNOTIFY, pvar->socket, MAKELPARAM(FD_READ, 0));
-		}
+		ssh2_scp_recv_unblocked(pvar);
 	}
 
 	logprintf(LOG_LEVEL_NOTICE,


Ttssh2-commit メーリングリストの案内
Back to archive index