httpd wip
authoroharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60>
Tue, 23 Dec 2008 08:52:02 +0000 (08:52 +0000)
committeroharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60>
Tue, 23 Dec 2008 08:52:02 +0000 (08:52 +0000)
git-svn-id: svn://svn.berlios.de/openocd/trunk@1272 b42882b7-edfa-0310-969c-e2dbd0fdcd60

src/server/httpd.c
src/server/httpd/build.sh
src/server/httpd/erase.tcl
src/server/httpd/httpd.tcl
src/server/httpd/menu.xml
src/server/httpd/openocd.tcl

index 103c92f03d1ce118af6a54a7430cbc13d65d12a5..4b876d30065656b23174589279a5c35c649fc1ee 100644 (file)
@@ -429,9 +429,14 @@ static int ahc_echo(void * cls, struct MHD_Connection * connection,
 }
 
 static struct MHD_Daemon * d;
+static pthread_mutex_t mutex;
+
 
 int httpd_start(void)
 {
+       pthread_mutexattr_t attr;
+       pthread_mutexattr_init( &attr );
+       pthread_mutex_init( &mutex, &attr );
 
        int port = 8888;
        LOG_USER("Launching httpd server on port %d", port);
@@ -461,15 +466,16 @@ int httpd_start(void)
 void httpd_stop(void)
 {
        MHD_stop_daemon(d);
+       pthread_mutex_destroy( &mutex );
 }
 
 void openocd_sleep_prelude(void)
 {
-       /* FIX!!!! add locking here!!!! */
+       pthread_mutex_unlock( &mutex );
 }
 
 void openocd_sleep_postlude(void)
 {
-       /* FIX!!!! add locking here!!!! */
+       pthread_mutex_lock( &mutex );
 }
 
index 93831a50e1b46e884e73bdfe159397a926e2308f..8824debf462a31c3a5682193261c9669ff95f4b4 100644 (file)
@@ -1,3 +1,5 @@
 set e
 java -classpath ../../../../zy1000/build/xalan.jar\;. Stylizer menu.xsl menu.xml .
 find . -regex ".*\.tcl" -type f -exec sh html2tcl.sh {} {} \;
+echo "Copy .tcl files to /usr/local/lib/openocd/httpd/"
+cp *.tcl /usr/local/lib/openocd/httpd/
\ No newline at end of file
index 3c29840d3a6784c0745e8da2b12358af4ee67119..fa9210736d6b12d42617c3139d99b2ca97487542 100644 (file)
@@ -161,7 +161,7 @@ append buffer {
                                set form_length 0x10000\r
                        }  \r
                        if {[string compare $form_address ""]==0} {\r
-                               if {[catch {[zy1000_flash]} result]==0} {\r
+                               if {[catch {[first_flash_base]} result]==0} {\r
                                                set form_address "0x[tohex $result]"\r
                                        }                       \r
                        }  \r
index 607660cc82e0afbb45e120f52c0fc42e24a4b7d4..a8bce162860f3a252da8aa175e377cbc82c4ec2f 100644 (file)
@@ -102,12 +102,12 @@ proc encode {a} {
 # catch any exceptions, capture output and return it \r
 proc capture_catch {a} {\r
        catch {\r
-               return [eval {capture $a}]\r
+               capture {uplevel $a}\r
        } result\r
-       return $result\r
+       return $result \r
 }\r
 \r
-proc zy1000_flash {} {\r
+proc first_flash_base {} {\r
        set t [lindex 0 [ocd_flash_banks]]\r
        return $t(base)\r
 }\r
index 11daef94f3a7bbf5468f522fa03015f25a3d0ca7..26ecf7a91c5f7d697b3f8b236f984c25f922b41e 100644 (file)
                                set form_length 0x10000\r
                        }  \r
                        if {[string compare $form_address ""]==0} {\r
-                               if {[catch {[zy1000_flash]} result]==0} {\r
+                               if {[catch {[first_flash_base]} result]==0} {\r
                                                set form_address "0x[tohex $result]"\r
                                        }                       \r
                        }  \r
@@ -794,8 +794,8 @@ append console [encode [capture_catch poll]]
                                set form_command [formfetch form_command]\r
 \r
                                set form_edittext ""\r
-                               if {[string length $form_command]>0} {                          \r
-                                       catch {capture_catch {eval "$form_command"}} form_edittext\r
+                               if {[string length $form_command]>0} {\r
+                                       set form_edittext [capture_catch {eval $form_command}]\r
                                }\r
                                \r
                                append buffer {<form action="openocd.tcl" method="post">} "\n"\r
index cb28026e8dcd352ca464b3e0ce5b7d604543ffdd..4fed3877700b07a1243dc45847593881a7537486 100644 (file)
@@ -154,8 +154,8 @@ append buffer {
                                set form_command [formfetch form_command]\r
 \r
                                set form_edittext ""\r
-                               if {[string length $form_command]>0} {                          \r
-                                       catch {capture_catch {eval "$form_command"}} form_edittext\r
+                               if {[string length $form_command]>0} {\r
+                                       set form_edittext [capture_catch {eval $form_command}]\r
                                }\r
                                \r
                                append buffer {<form action="openocd.tcl" method="post">} "\n"\r

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)