Fix 2013/mills + format/typo checks

The problem that was showing up is that one could connect and it would
show the time once but then it would close the connection and be unable
to connect again, showing an error in the browser. After looking at the
code it became clear it is because the backlog to listen(2) was 1 and
this is not enough for close(2) and then immediately listening again.

I updated the bugs.md file too - added a feature, not a bug. The author
notes that one cannot start the program right after termination and have
the program successfully bind the socket. They did note the fix and it's
well known (at least to those of us who are experienced in socket
programming :-) ) but as it was documented it is a feature not a bug. It
just means one has to wait for a few seconds (though 'few seconds' can
vary).

The README.md file has been format fixed.
This commit is contained in:
Cody Boone Ferguson committed 2023-12-02 11:51:18 -08:00
1 parent c109cd23cc
commit b157e5ddaf
3 files changed
+28 -4

No files matched your search

+17 -3
View File
@@ -5,6 +5,17 @@ make
```
### Bugs and (Mis)features:
The current status of this entry is:
```
STATUS: INABIAF - please **DO NOT** fix
```
For more detailed information see [2013 mills in bugs.md](/bugs.md#2013-mills).
## To use:
```sh
@@ -57,6 +68,7 @@ n=1,setsockopt(s,SOL_SOCKET,SO_REUSEADDR,&n,sizeof n),
at an appropriate spot in the code (an exercise left to the reader). However,
as this limitation is documented, it is not technically a bug.
### Details of Operation
The program wears many hats (not literally). It is
@@ -73,7 +85,7 @@ displayed initially at a lower resolution and allowed to be progressively
refined as time goes on. The ray tracer is integrally tied to the PNG encoder,
casting rays in the Adam7 order. The web server uses PNG primarily because of
PNG's ability to return data progressively, and not as you might think it being
because the PNG standard is so obfuscated as to require both little- and
because the PNG standard is so obfuscated as to require both little and
big-endian encodings at different spec layers.
Since ray-tracing was an obvious choice to return to a web server, I needed
@@ -83,7 +95,7 @@ inspiration (as I often do) from the IOCCC remarks file which says
> At least one judge prefers to maintain the use of the leap-second
> as part of the world's time standard.
Then it was obvious; The code should display the time. It is believed (but
Then it was obvious; the code should display the time. It is believed (but
not confirmed) that the code will, in fact, display leap seconds correctly.
To display the time, of course we would need a font. This font is encoded
@@ -92,6 +104,7 @@ intended this use of whitespace for data compression, since their tool
doesn't count whitespace in strings differently than whitespace outside of
them.
### User-modifiable Features
The code can be user-modified simply by changing the build command line.
@@ -107,6 +120,7 @@ list above (three times the number of lights).
* `-DEY=x,y,z` defines the position of the viewer (the eye point) for the scene.
The eye is looking at the origin `(0, 0, 0)`.
### Other Build Flags
The original program bound the server to `INADDR_ANY` to allow everyone to
@@ -117,7 +131,7 @@ of innumerable post-ship late feature additions, I have modified the
spherical symmetry of the source code. In addition, I have altered the word
`sin_port` to the more family-friendly version `win_port` (via
`-Dwin_port="sin_addr.s_addr=htonl(2130706433),R.sin_port"`) to protect against
curious impressionable youth trying to learn about sockets on Internet.
curious impressionable youth trying to learn about sockets on the Internet.
## Copyright and CC BY-SA 4.0 License:
+1 -1
View File
@@ -25,7 +25,7 @@ r(e-p-8); while(p!=e){ c^=*p++; for(j=0; 8>j; j++)c=c/2^c%2*3988292384; } r(~c);
(); } void q(int c){ w(c); m+=c; m%=c=65521; n+=m; n%=c; } void T(F c){ c=.5+255
*c; q(0>c?0:c>255?255:c); } struct sockaddr_in R; int main(){ time_t i; struct
tm*b; R.win_port=8224; s=socket(R.sin_family=AF_INET,SOCK_STREAM,0); bind(s,
(void*)&R, sizeof R); listen(s,1); for(; ; ){ k=accept(s,0,0); for(; ; ){ ++j;
(void*)&R, sizeof R); listen(s,10); for(; ; ){ k=accept(s,0,0); for(; ; ){ ++j;
read(k,p,1); if(*p=='\n') { if(3>j)break; j=0; } } m=1; u("\n\032\n\rGNP"
"\211\n\r\n\r1 :hserfeR\n\rKO 002 0.1/PTTH"); Z("RDHI"); r(800); r(600); w
(8); r(33554433); J(); Z(0); w(120); w(1); J(); i=time(0); b=localtime(&
+10
View File
@@ -3615,6 +3615,16 @@ Further, after the file 2013/hou/doc/example.markdown was moved to
this broke `make` which Cody also fixed.
## [2013/mills](2013/mills/mills.c) ([README.md)[2013/mills/README.md))
[Cody](#cody) fixed this so that the server would not refuse the connection
after the first call to `close(2)`. The problem was that because the backlog to
`listen(2)` was 1 once the connection closed the server was essentially 'dead'.
The backlog was changed to 10 and this solves the problem. It is not known if
this was specific to macOS but it was not specific to a browser as Safari and
Firefox both had the problem.
## [2013/misaka](2013/misaka/misaka.c) ([README.md)[2013/misaka/README.md))
[Cody](#cody) added the [try.sh](2013/misaka/try.sh) script.