support abort in administra network code, re-init connections in websrv
This commit is contained in:
parent
86f42864ec
commit
7b7e5bde66
|
@ -2493,7 +2493,7 @@ PRI lan_txflush | handleidx
|
||||||
|
|
||||||
handleidx := bus_getchar
|
handleidx := bus_getchar
|
||||||
|
|
||||||
sock.flush(sockhandle[handleidx])
|
\sock.flush(sockhandle[handleidx])
|
||||||
|
|
||||||
bus_putchar(TRUE)
|
bus_putchar(TRUE)
|
||||||
|
|
||||||
|
@ -2554,7 +2554,7 @@ PRI lan_start | hiveid, hivestr, strpos, macpos, i, a
|
||||||
byte[hivestr+strpos] := 0
|
byte[hivestr+strpos] := 0
|
||||||
macpos--
|
macpos--
|
||||||
|
|
||||||
sock.start(A_NETCS,A_NETSCK,A_NETSI,A_NETSO, -1, @mac_addr, @ip_addr)
|
\sock.start(A_NETCS,A_NETSCK,A_NETSI,A_NETSO, -1, @mac_addr, @ip_addr)
|
||||||
lan_started := true
|
lan_started := true
|
||||||
|
|
||||||
|
|
||||||
|
@ -2566,7 +2566,7 @@ PRI lan_stop
|
||||||
''busprotokoll : [072]
|
''busprotokoll : [072]
|
||||||
|
|
||||||
if lan_started
|
if lan_started
|
||||||
sock.stop
|
\sock.stop
|
||||||
lan_started := false
|
lan_started := false
|
||||||
|
|
||||||
PRI lan_connect | ipaddr, remoteport, handle, handleidx, i
|
PRI lan_connect | ipaddr, remoteport, handle, handleidx, i
|
||||||
|
@ -2589,8 +2589,8 @@ PRI lan_connect | ipaddr, remoteport, handle, handleidx, i
|
||||||
quit
|
quit
|
||||||
i++
|
i++
|
||||||
|
|
||||||
ifnot (handle := sock.connect(ipaddr, remoteport, @bufmain[i*rxlen], rxlen, @buftx[i*txlen], txlen)) == -102
|
ifnot (handle := \sock.connect(ipaddr, remoteport, @bufmain[i*rxlen], rxlen, @buftx[i*txlen], txlen)) == -102
|
||||||
sock.resetBuffers(handle)
|
\sock.resetBuffers(handle)
|
||||||
handleidx := handle.byte[0] 'extract the handle index from the lower 8 bits
|
handleidx := handle.byte[0] 'extract the handle index from the lower 8 bits
|
||||||
sockhandle[handleidx] := handle 'komplettes handle zu handle index speichern
|
sockhandle[handleidx] := handle 'komplettes handle zu handle index speichern
|
||||||
bufidx[i] :=handleidx
|
bufidx[i] :=handleidx
|
||||||
|
@ -2613,7 +2613,7 @@ PRI lan_listen | port, handle, handleidx, i
|
||||||
port := sub_getword
|
port := sub_getword
|
||||||
|
|
||||||
if handleidx <> $FF 'bestehender (kein neuer) Socket
|
if handleidx <> $FF 'bestehender (kein neuer) Socket
|
||||||
if sock.isValidHandle(sockhandle[handleidx]) 'Socket gültig
|
if \sock.isValidHandle(sockhandle[handleidx]) 'Socket gültig
|
||||||
bus_putchar(handleidx) 'alten handleidx zurücksenden
|
bus_putchar(handleidx) 'alten handleidx zurücksenden
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -2630,7 +2630,7 @@ PRI lan_listen | port, handle, handleidx, i
|
||||||
quit
|
quit
|
||||||
i++
|
i++
|
||||||
|
|
||||||
ifnot (handle := sock.listen(port, @bufmain[i*rxlen], rxlen, @buftx[i*txlen], txlen)) == -102
|
ifnot (handle := \sock.listen(port, @bufmain[i*rxlen], rxlen, @buftx[i*txlen], txlen)) == -102
|
||||||
handleidx := handle.byte[0] 'extract the handle index from the lower 8 bits
|
handleidx := handle.byte[0] 'extract the handle index from the lower 8 bits
|
||||||
sockhandle[handleidx] := handle 'komplettes handle zu handle index speichern
|
sockhandle[handleidx] := handle 'komplettes handle zu handle index speichern
|
||||||
bufidx[i] :=handleidx
|
bufidx[i] :=handleidx
|
||||||
|
@ -2652,7 +2652,7 @@ PRI lan_waitconntimeout | handleidx, timeout, t, connected
|
||||||
timeout := sub_getword
|
timeout := sub_getword
|
||||||
|
|
||||||
t := cnt
|
t := cnt
|
||||||
repeat until (connected := sock.isConnected(sockhandle[handleidx])) or (((cnt - t) / (clkfreq / 1000)) > timeout)
|
repeat until (connected := \sock.isConnected(sockhandle[handleidx])) or (((cnt - t) / (clkfreq / 1000)) > timeout)
|
||||||
|
|
||||||
bus_putchar(connected)
|
bus_putchar(connected)
|
||||||
|
|
||||||
|
@ -2666,7 +2666,7 @@ PRI lan_close | handleidx, i
|
||||||
|
|
||||||
handleidx := bus_getchar
|
handleidx := bus_getchar
|
||||||
|
|
||||||
sock.close(sockhandle[handleidx])
|
\sock.close(sockhandle[handleidx])
|
||||||
|
|
||||||
'reservierten Pufferabschnitt freigeben
|
'reservierten Pufferabschnitt freigeben
|
||||||
i := 0
|
i := 0
|
||||||
|
@ -2693,7 +2693,7 @@ PRI lan_rxtime | handleidx, timeout, t, rxbyte
|
||||||
timeout := sub_getword
|
timeout := sub_getword
|
||||||
|
|
||||||
t := cnt
|
t := cnt
|
||||||
repeat until (rxbyte := sock.readByteNonBlocking(sockhandle[handleidx])) => 0 or (not sock.isConnected(sockhandle[handleidx])) or (cnt - t) / (clkfreq / 1000) > timeout
|
repeat until (rxbyte := \sock.readByteNonBlocking(sockhandle[handleidx])) => 0 or (not \sock.isConnected(sockhandle[handleidx])) or (cnt - t) / (clkfreq / 1000) > timeout
|
||||||
|
|
||||||
bus_putchar(rxbyte)
|
bus_putchar(rxbyte)
|
||||||
|
|
||||||
|
@ -2713,8 +2713,8 @@ PRI lan_rxdata | handleidx, len, rxbyte, error
|
||||||
|
|
||||||
repeat len
|
repeat len
|
||||||
ifnot error
|
ifnot error
|
||||||
repeat while (rxbyte := sock.readByteNonBlocking(sockhandle[handleidx])) < 0
|
repeat while (rxbyte := \sock.readByteNonBlocking(sockhandle[handleidx])) < 0
|
||||||
ifnot sock.isConnected(sockhandle[handleidx])
|
ifnot \sock.isConnected(sockhandle[handleidx])
|
||||||
error := sock#ERRSOCKETCLOSED
|
error := sock#ERRSOCKETCLOSED
|
||||||
quit
|
quit
|
||||||
bus_putchar(rxbyte)
|
bus_putchar(rxbyte)
|
||||||
|
@ -2738,8 +2738,8 @@ PRI lan_txdata | handleidx, len, txbyte, error
|
||||||
repeat len
|
repeat len
|
||||||
txbyte := bus_getchar
|
txbyte := bus_getchar
|
||||||
ifnot error
|
ifnot error
|
||||||
repeat while sock.writeByteNonBlocking(sockhandle[handleidx], txbyte) < 0
|
repeat while \sock.writeByteNonBlocking(sockhandle[handleidx], txbyte) < 0
|
||||||
ifnot sock.isConnected(sockhandle[handleidx])
|
ifnot \sock.isConnected(sockhandle[handleidx])
|
||||||
error := sock#ERRSOCKETCLOSED
|
error := sock#ERRSOCKETCLOSED
|
||||||
quit
|
quit
|
||||||
|
|
||||||
|
@ -2756,7 +2756,7 @@ PRI lan_rxbyte
|
||||||
'' : rxbyte - empfangenes Zeichen oder
|
'' : rxbyte - empfangenes Zeichen oder
|
||||||
'' : sock#RETBUFFEREMPTY (-1) wenn kein Zeichen vorhanden
|
'' : sock#RETBUFFEREMPTY (-1) wenn kein Zeichen vorhanden
|
||||||
|
|
||||||
bus_putchar(sock.readByteNonBlocking(sockhandle[bus_getchar]))
|
bus_putchar(\sock.readByteNonBlocking(sockhandle[bus_getchar]))
|
||||||
|
|
||||||
PRI lan_isconnected
|
PRI lan_isconnected
|
||||||
''funktionsgruppe : lan
|
''funktionsgruppe : lan
|
||||||
|
@ -2767,7 +2767,7 @@ PRI lan_isconnected
|
||||||
'' : handleidx - lfd. Nr. der Verbindung
|
'' : handleidx - lfd. Nr. der Verbindung
|
||||||
'' : connected - TRUE wenn verbunden, sonst FALSE
|
'' : connected - TRUE wenn verbunden, sonst FALSE
|
||||||
|
|
||||||
bus_putchar(sock.isConnected(sockhandle[bus_getchar]))
|
bus_putchar(\sock.isConnected(sockhandle[bus_getchar]))
|
||||||
|
|
||||||
DAT
|
DAT
|
||||||
long ' long alignment for addresses
|
long ' long alignment for addresses
|
||||||
|
|
|
@ -64,7 +64,7 @@ VAR
|
||||||
|
|
||||||
long cog, random_value
|
long cog, random_value
|
||||||
|
|
||||||
PUB main
|
PUB main | i
|
||||||
|
|
||||||
rr_start
|
rr_start
|
||||||
|
|
||||||
|
@ -85,16 +85,19 @@ PUB main
|
||||||
getcfg
|
getcfg
|
||||||
ios.print(@strMsgEnd)
|
ios.print(@strMsgEnd)
|
||||||
|
|
||||||
|
i := 0
|
||||||
repeat
|
repeat
|
||||||
if ios.keystat > 0
|
if ios.keystat > 0
|
||||||
quit
|
quit
|
||||||
if (handleidx := ios.lan_listen(handleidx,80)) == $FF 'Empfangs-Socket auf Port 80 öffnen
|
if (handleidx := ios.lan_listen(handleidx,80)) == $FF 'Empfangs-Socket auf Port 80 öffnen
|
||||||
ios.print(@strErrorNoSock)
|
if i > 20
|
||||||
quit
|
ios.print(@strErrorNoSock)
|
||||||
|
quit
|
||||||
|
else
|
||||||
|
i++
|
||||||
|
next
|
||||||
|
i := 0
|
||||||
if ios.lan_isconnected(handleidx) 'bei bestehender Verbindung...
|
if ios.lan_isconnected(handleidx) 'bei bestehender Verbindung...
|
||||||
#ifdef __DEBUG
|
|
||||||
ios.print(@strConnected)
|
|
||||||
#endif
|
|
||||||
if webThread == 0
|
if webThread == 0
|
||||||
ios.lan_txflush(handleidx)
|
ios.lan_txflush(handleidx)
|
||||||
ios.lan_close(handleidx)
|
ios.lan_close(handleidx)
|
||||||
|
@ -224,7 +227,6 @@ DAT ' Locale
|
||||||
|
|
||||||
strNoNetwork byte 13,"Administra doesn't provide network functions!",13,"Please load admnet.",13,0
|
strNoNetwork byte 13,"Administra doesn't provide network functions!",13,"Please load admnet.",13,0
|
||||||
strWaitConnection byte "Waiting for client connection...",13,0
|
strWaitConnection byte "Waiting for client connection...",13,0
|
||||||
strConnected byte "Client connected...",13,0
|
|
||||||
strErrorNoSock byte "No free socket.",13,0
|
strErrorNoSock byte "No free socket.",13,0
|
||||||
strErrorOpen byte "Can't open configuration file",13,0
|
strErrorOpen byte "Can't open configuration file",13,0
|
||||||
strAddr byte 13,"Webserver startet, please use this URL to connect:",13," http://",0
|
strAddr byte 13,"Webserver startet, please use this URL to connect:",13," http://",0
|
||||||
|
@ -238,7 +240,6 @@ DAT ' Locale
|
||||||
|
|
||||||
strNoNetwork byte 13,"Administra stellt keine Netzwerk-Funktionen zur Verfügung!",13,"Bitte admnet laden.",13,0
|
strNoNetwork byte 13,"Administra stellt keine Netzwerk-Funktionen zur Verfügung!",13,"Bitte admnet laden.",13,0
|
||||||
strWaitConnection byte "Warte auf Client-Verbindung...",13,0
|
strWaitConnection byte "Warte auf Client-Verbindung...",13,0
|
||||||
strConnected byte "Client verbunden...",13,0
|
|
||||||
strErrorNoSock byte "Kein Socket frei...",13,0
|
strErrorNoSock byte "Kein Socket frei...",13,0
|
||||||
strErrorOpen byte "Kann Konfigurationsdatei nicht öffnen.",13,0
|
strErrorOpen byte "Kann Konfigurationsdatei nicht öffnen.",13,0
|
||||||
strAddr byte 13,"Webserver gestartet, zum Verbinden folgende URL verwenden:",13," http://",0
|
strAddr byte 13,"Webserver gestartet, zum Verbinden folgende URL verwenden:",13," http://",0
|
||||||
|
|
Loading…
Reference in New Issue