mirror of
https://github.com/ksherlock/marlene.git
synced 2025-01-02 23:30:11 +00:00
when closing TIMEWAIT is an acceptable status.
This commit is contained in:
parent
1380609800
commit
6ba329b50b
6
main.c
6
main.c
@ -35,7 +35,7 @@ extern pascal void InitColorTable(ColorTable) inline(0x0D04,dispatcher);
|
|||||||
|
|
||||||
|
|
||||||
Word ResolveHost(const char *name, cvtRecPtr cvt);
|
Word ResolveHost(const char *name, cvtRecPtr cvt);
|
||||||
int WaitForStatus(word ipid, word status);
|
int WaitForStatus(word ipid, word status_mask);
|
||||||
|
|
||||||
|
|
||||||
void display_pstr(const char *);
|
void display_pstr(const char *);
|
||||||
@ -265,7 +265,7 @@ int main(int argc, char **argv) {
|
|||||||
TCPIPOpenTCP(ipid);
|
TCPIPOpenTCP(ipid);
|
||||||
|
|
||||||
// wait for the connection to occur.
|
// wait for the connection to occur.
|
||||||
ok = WaitForStatus(ipid, TCPSESTABLISHED);
|
ok = WaitForStatus(ipid, 1 << TCPSESTABLISHED);
|
||||||
if (ok > 0) display_err(ok);
|
if (ok > 0) display_err(ok);
|
||||||
if (ok != 0) goto _exit2;
|
if (ok != 0) goto _exit2;
|
||||||
|
|
||||||
@ -347,7 +347,7 @@ _exit1:
|
|||||||
display_cstr("\n\rClosing TCP Connection...\n\r");
|
display_cstr("\n\rClosing TCP Connection...\n\r");
|
||||||
|
|
||||||
TCPIPCloseTCP(ipid);
|
TCPIPCloseTCP(ipid);
|
||||||
WaitForStatus(ipid, TCPSCLOSED);
|
WaitForStatus(ipid, (1 << TCPSCLOSED) | (1 << TCPSTIMEWAIT));
|
||||||
|
|
||||||
_exit2:
|
_exit2:
|
||||||
|
|
||||||
|
@ -87,17 +87,20 @@ EventRecord event;
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int WaitForStatus(word ipid, word status) {
|
int WaitForStatus(word ipid, word status_mask) {
|
||||||
static srBuffer sr;
|
static srBuffer sr;
|
||||||
EventRecord event;
|
EventRecord event;
|
||||||
Word err;
|
Word err;
|
||||||
|
unsigned bits;
|
||||||
|
|
||||||
for(;;) {
|
for(;;) {
|
||||||
TCPIPPoll();
|
TCPIPPoll();
|
||||||
err = TCPIPStatusTCP(ipid, &sr);
|
err = TCPIPStatusTCP(ipid, &sr);
|
||||||
if (err) return err;
|
if (err) return err;
|
||||||
|
|
||||||
if (sr.srState == status) return 0;
|
bits = 1 << sr.srState;
|
||||||
|
if (status_mask & bits) return 0;
|
||||||
|
|
||||||
GetNextEvent(keyDownMask | autoKeyMask, &event);
|
GetNextEvent(keyDownMask | autoKeyMask, &event);
|
||||||
if (event.what != keyDownEvt) continue;
|
if (event.what != keyDownEvt) continue;
|
||||||
if (!(event.modifiers & appleKey)) continue;
|
if (!(event.modifiers & appleKey)) continue;
|
||||||
|
Loading…
Reference in New Issue
Block a user