summaryrefslogtreecommitdiff
path: root/uip/psock.c
diff options
context:
space:
mode:
authorJeffrey Armstrong <jeffrey.armstrong@approximatrix.com>2016-12-14 09:14:39 -0500
committerJeffrey Armstrong <jeffrey.armstrong@approximatrix.com>2016-12-14 09:14:39 -0500
commitdc65ef038279df55d5e49052eabac4eae2617ee1 (patch)
tree84c7ffc081482c18c2bc0a6ddb1a4d6dd260f925 /uip/psock.c
parent84de937689bcb35ea3ddae55d9c74dc23463f79c (diff)
downloaduIP-FOSSIL-dc65ef038279df55d5e49052eabac4eae2617ee1.tar.gz
uIP-FOSSIL-dc65ef038279df55d5e49052eabac4eae2617ee1.zip
Now compiles with Turbo C 2.0 using included makefile. Added better logging (to screen). Added supprot for opening and sending gzip'ed files if available on disk.
Diffstat (limited to 'uip/psock.c')
-rw-r--r--uip/psock.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/uip/psock.c b/uip/psock.c
index 95ad542..8f2a83b 100644
--- a/uip/psock.c
+++ b/uip/psock.c
@@ -144,6 +144,7 @@ buf_bufto(register struct psock_buf *buf, u8_t endmarker,
static char
send_data(register struct psock *s)
{
+
if(s->state != STATE_DATA_SENT || uip_rexmit()) {
if(s->sendlen > uip_mss()) {
uip_send(s->sendptr, uip_mss());
@@ -172,6 +173,18 @@ data_acked(register struct psock *s)
}
return 0;
}
+
+static char send_and_ack(register struct psock *s)
+{
+char sent;
+char ack;
+
+ ack = data_acked(s);
+ sent = send_data(s);
+
+ return ack && sent;
+}
+
/*---------------------------------------------------------------------------*/
PT_THREAD(psock_send(register struct psock *s, const char *buf,
unsigned int len))
@@ -193,7 +206,6 @@ PT_THREAD(psock_send(register struct psock *s, const char *buf,
/* We loop here until all data is sent. The s->sendlen variable is
updated by the data_sent() function. */
while(s->sendlen > 0) {
-
/*
* The condition for this PT_WAIT_UNTIL is a little tricky: the
* protothread will wait here until all data has been acknowledged
@@ -204,7 +216,9 @@ PT_THREAD(psock_send(register struct psock *s, const char *buf,
* && operator, which would cause only the data_acked() function
* to be called when it returns false.
*/
- PT_WAIT_UNTIL(&s->psockpt, data_acked(s) & send_data(s));
+
+ /* PT_WAIT_UNTIL(&s->psockpt, data_acked(s) & send_data(s)); */
+ PT_WAIT_UNTIL(&s->psockpt, send_and_ack(s));
}
s->state = STATE_NONE;
@@ -235,7 +249,8 @@ PT_THREAD(psock_generator_send(register struct psock *s,
generate(arg);
}
/* Wait until all data is sent and acknowledged. */
- PT_WAIT_UNTIL(&s->psockpt, data_acked(s) & send_data(s));
+ /* PT_WAIT_UNTIL(&s->psockpt, data_acked(s) & send_data(s)); */
+ PT_WAIT_UNTIL(&s->psockpt, send_and_ack(s));
} while(s->sendlen > 0);
s->state = STATE_NONE;