mirror of
https://github.com/arduino/Arduino.git
synced 2025-03-15 12:29:26 +01:00
Fixing Client::connected() and Client::status() to return reasonable values when the Client isn't associated with a valid socket: issue #34.
This commit is contained in:
parent
051d8f2e4f
commit
3b09a2ad1d
@ -113,14 +113,22 @@ void Client::stop() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
uint8_t Client::connected() {
|
uint8_t Client::connected() {
|
||||||
|
if (_sock == 255) {
|
||||||
|
return 0;
|
||||||
|
} else {
|
||||||
uint8_t s = status();
|
uint8_t s = status();
|
||||||
return !(s == SOCK_LISTEN || s == SOCK_CLOSED || s == SOCK_FIN_WAIT ||
|
return !(s == SOCK_LISTEN || s == SOCK_CLOSED || s == SOCK_FIN_WAIT ||
|
||||||
(s == SOCK_CLOSE_WAIT && !available()));
|
(s == SOCK_CLOSE_WAIT && !available()));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
uint8_t Client::status() {
|
uint8_t Client::status() {
|
||||||
|
if (_sock == 255) {
|
||||||
|
return SOCK_CLOSED;
|
||||||
|
} else {
|
||||||
return getSn_SR(_sock);
|
return getSn_SR(_sock);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// the next three functions are a hack so we can compare the client returned
|
// the next three functions are a hack so we can compare the client returned
|
||||||
// by Server::available() to null, or use it as the condition in an
|
// by Server::available() to null, or use it as the condition in an
|
||||||
|
6
todo.txt
6
todo.txt
@ -3,12 +3,14 @@
|
|||||||
|
|
||||||
PROCESSING 5503 SYNC
|
PROCESSING 5503 SYNC
|
||||||
|
|
||||||
Serial monitor errors should appear in serial monitor.
|
|
||||||
|
|
||||||
Don't require save before upload.
|
Don't require save before upload.
|
||||||
|
|
||||||
Add library keyword highlighting.
|
Add library keyword highlighting.
|
||||||
|
|
||||||
|
Allow closing of the serial monitor with keyboard short cuts.
|
||||||
|
|
||||||
|
Support libraries in the SKETCH/code folder?
|
||||||
|
|
||||||
Get rid of unused preferences in the preferences dialog.
|
Get rid of unused preferences in the preferences dialog.
|
||||||
|
|
||||||
Don't allow in-place modification of user-installed library examples.
|
Don't allow in-place modification of user-installed library examples.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user