mirror of
https://github.com/ksherlock/marlene.git
synced 2024-12-21 22:29:28 +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);
|
||||
int WaitForStatus(word ipid, word status);
|
||||
int WaitForStatus(word ipid, word status_mask);
|
||||
|
||||
|
||||
void display_pstr(const char *);
|
||||
@ -265,7 +265,7 @@ int main(int argc, char **argv) {
|
||||
TCPIPOpenTCP(ipid);
|
||||
|
||||
// wait for the connection to occur.
|
||||
ok = WaitForStatus(ipid, TCPSESTABLISHED);
|
||||
ok = WaitForStatus(ipid, 1 << TCPSESTABLISHED);
|
||||
if (ok > 0) display_err(ok);
|
||||
if (ok != 0) goto _exit2;
|
||||
|
||||
@ -347,7 +347,7 @@ _exit1:
|
||||
display_cstr("\n\rClosing TCP Connection...\n\r");
|
||||
|
||||
TCPIPCloseTCP(ipid);
|
||||
WaitForStatus(ipid, TCPSCLOSED);
|
||||
WaitForStatus(ipid, (1 << TCPSCLOSED) | (1 << TCPSTIMEWAIT));
|
||||
|
||||
_exit2:
|
||||
|
||||
|
@ -87,17 +87,20 @@ EventRecord event;
|
||||
return false;
|
||||
}
|
||||
|
||||
int WaitForStatus(word ipid, word status) {
|
||||
int WaitForStatus(word ipid, word status_mask) {
|
||||
static srBuffer sr;
|
||||
EventRecord event;
|
||||
Word err;
|
||||
unsigned bits;
|
||||
|
||||
for(;;) {
|
||||
TCPIPPoll();
|
||||
err = TCPIPStatusTCP(ipid, &sr);
|
||||
if (err) return err;
|
||||
|
||||
if (sr.srState == status) return 0;
|
||||
bits = 1 << sr.srState;
|
||||
if (status_mask & bits) return 0;
|
||||
|
||||
GetNextEvent(keyDownMask | autoKeyMask, &event);
|
||||
if (event.what != keyDownEvt) continue;
|
||||
if (!(event.modifiers & appleKey)) continue;
|
||||
|
Loading…
Reference in New Issue
Block a user