Skip to content

Commit e37595f

Browse files
authored
Merge pull request #28 from anderspkd/27_tcp_read_write_incorrect_error_handling
bugfix for improper error handling in TCP code.
2 parents 59c1e4c + ad561df commit e37595f

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

include/scl/math/array.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ class Array final {
135135
* This function will attempt to construct a \p T element using \p value, and
136136
* then fill all slots with this value.
137137
*/
138-
explicit Array(int value) : Array(T{value}) {};
138+
explicit Array(int value) : Array(T{value}) {}
139139

140140
/**
141141
* @brief Copy construct an Array from another array.

include/scl/net/tcp_channel.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -151,10 +151,10 @@ coro::Task<void> TcpChannel<SYS>::send(const Packet& packet) {
151151
} else {
152152
throw std::system_error(err, std::generic_category(), "send failed");
153153
}
154+
} else {
155+
rem -= written;
156+
data += written;
154157
}
155-
156-
rem -= written;
157-
data += written;
158158
}
159159
}
160160

@@ -178,10 +178,10 @@ coro::Task<void> recvInto(SocketType socket,
178178
} else {
179179
throw std::system_error(err, std::generic_category(), "recv failed");
180180
}
181+
} else {
182+
rem -= read;
183+
dst += read;
181184
}
182-
183-
rem -= read;
184-
dst += read;
185185
}
186186
}
187187

0 commit comments

Comments
 (0)