aboutsummaryrefslogtreecommitdiffstats
path: root/examples/historical/patches/vlc-git-sesse.patch
blob: a38b378d00131347f2d8fa2ff74d953da89d175a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
diff --git a/modules/access_output/http.c b/modules/access_output/http.c
index 61095f5..18ffc9a 100644
--- a/modules/access_output/http.c
+++ b/modules/access_output/http.c
@@ -72,9 +72,17 @@ vlc_module_begin ()
                   PASS_TEXT, PASS_LONGTEXT, true )
     add_string( SOUT_CFG_PREFIX "mime", "",
                 MIME_TEXT, MIME_LONGTEXT, true )
+    add_integer( SOUT_CFG_PREFIX "mark-start", "",
+                "lol", "Fancy option", -1 )
+    add_integer( SOUT_CFG_PREFIX "mark-end", "",
+                "rotfl", "Should maybe also be set", -1 )
     set_callbacks( Open, Close )
 vlc_module_end ()
 
+// globals
+extern vlc_mutex_t mark_lock;
+extern int *mark_used;
+extern int mark_start, mark_end;
 
 /*****************************************************************************
  * Exported prototypes
@@ -178,6 +186,21 @@ static int Open( vlc_object_t *p_this )
         return VLC_EGENERIC;
     }
 
+    fprintf(stderr, "tjobing\n");
+    if (mark_used == NULL) {
+      mark_start = var_InheritInteger( p_access, SOUT_CFG_PREFIX "mark-start");
+      mark_end = var_InheritInteger( p_access, SOUT_CFG_PREFIX "mark-end");
+      fprintf(stderr, "jabla: %d -> %d\n", mark_start, mark_end);
+
+      if (mark_start >= 0 && mark_end > mark_start) {
+        vlc_mutex_init(&mark_lock);
+        mark_used = (int *)malloc((mark_end - mark_start) * sizeof(int));
+        for (int i = 0; i < mark_end - mark_start; ++i) {
+          mark_used[i] = 0;
+        }
+      }
+    }
+
     psz_user = var_GetNonEmptyString( p_access, SOUT_CFG_PREFIX "user" );
     psz_pwd = var_GetNonEmptyString( p_access, SOUT_CFG_PREFIX "pwd" );
     if( p_access->psz_access && !strcmp( p_access->psz_access, "mmsh" ) )
diff --git a/src/libvlccore.sym b/src/libvlccore.sym
index 25d83c5..335edda 100644
--- a/src/libvlccore.sym
+++ b/src/libvlccore.sym
@@ -631,3 +631,7 @@ xml_ReaderDelete
 xml_ReaderReset
 vlc_keycode2str
 vlc_str2keycode
+mark_end
+mark_lock
+mark_start
+mark_used
diff --git a/src/network/httpd.c b/src/network/httpd.c
index f76c47c..d7897bb 100644
--- a/src/network/httpd.c
+++ b/src/network/httpd.c
@@ -67,6 +67,50 @@
 
 static void httpd_ClientClean( httpd_client_t *cl );
 
+VLC_API vlc_mutex_t mark_lock;
+VLC_API int *mark_used = NULL;
+VLC_API int mark_start = -1;
+VLC_API int mark_end = -1;
+
+void mark_socket(int fd)
+{
+    vlc_mutex_lock(&mark_lock);
+    int best_mark = mark_start;
+    int best_mark_val = mark_used[0];
+
+    for (int i = 1; i < mark_end - mark_start; ++i) {
+        if (mark_used[i] < best_mark_val) {
+            best_mark = mark_start + i;
+            best_mark_val = mark_used[i];
+        }
+    }
+    fprintf( stderr, "PICKED MARK %d WITH OLD USAGE %d\n", best_mark, best_mark_val);
+    if (setsockopt (fd, SOL_SOCKET, SO_MARK, &best_mark, sizeof(best_mark)) == -1) {
+        perror("setsockopt(SO_MARK)");
+    } else {
+        ++mark_used[best_mark - mark_start];
+    }
+    vlc_mutex_unlock(&mark_lock);
+}
+
+void unmark_socket(int fd)
+{
+    int mark;
+    socklen_t mark_len = sizeof(mark);
+    if (getsockopt (fd, SOL_SOCKET, SO_MARK, &mark, &mark_len) == -1) {
+        perror("getsockopt(SO_MARK)");
+        return;
+    }
+    if (mark < mark_start || mark >= mark_end) {
+        fprintf("UNKNOWN MARK %d\n", mark);
+    }
+
+    vlc_mutex_lock(&mark_lock);
+    --mark_used[mark - mark_start];
+    fprintf(stderr, "UNMARKED MARK %d WITH NEW USAGE %d\n", mark, mark_used[mark - mark_start]);
+    vlc_mutex_unlock(&mark_lock);
+}
+
 /* each host run in his own thread */
 struct httpd_host_t
 {
@@ -1295,6 +1339,7 @@ static void httpd_ClientClean( httpd_client_t *cl )
     {
         if( cl->p_tls != NULL )
             vlc_tls_SessionDelete( cl->p_tls );
+        unmark_socket( cl->fd );
         net_Close( cl->fd );
         cl->fd = -1;
     }
@@ -2309,6 +2354,11 @@ static void* httpd_HostThread( void *data )
             setsockopt (fd, SOL_SOCKET, SO_REUSEADDR,
                         &(int){ 1 }, sizeof(int));
 
+            // find a free mark
+            if (mark_used != NULL) {
+                mark_socket(fd);
+            }
+
             vlc_tls_t *p_tls;
 
             if( host->p_tls != NULL )
ont-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
# Version 0.5

## Highlighted features
* It should now be possible to develop the software on OSX 
* Base design refactored: CSS simplified and reduced, base design colours removed, now provided in example Alaveteli theme override
* It is now possible to rebuild the xapian index for specific terms, rather than having to drop and rebuild the entire database every time (as previously).  See rake xapian:rebuild_index for more info. 
* When listing authorities, show all authorities in default locale, rather than only those in the currently selected locale.
* Ensure incoming emails are only ever parsed once (should give a performance boost)
* [Full list of changes on github](https://github.com/sebbacon/alaveteli/issues?state=closed&milestone=9)

## Upgrade notes
* **IMPORTANT! We now depend on Xapian 1.2**, which means you may need to install Xapian from backports.  See [issue #159](https://github.com/sebbacon/alaveteli/issues/159) for more info.
* Themes created for 0.4 and below should be changed to match the new format (although the old way should continue to work):
  * You should create a resources folder at `<yourtheme>/public/` and symlink to it from the main rails app.  See the `install.rb` in `alaveteli-theme` example theme for details.
  * Your styles should be moved from `general/custom_css.rhtml` to a standalone stylesheet in `<yourtheme>/public/stylesheets/`
  * The partial at `general/_before_head_end.rhtml` should be changed in the theme to include this stylesheet
* [issue #281](https://github.com/sebbacon/alaveteli/issues/281) fixes some bugs relating to display of internationalised emails.  To fix any wrongly displayed emails, you'll need to run the script at `script/clear-caches` so that the caches can be regenerated
* During this release, a bug was discovered in pdftk 1.44 which caused it to loop forever.  Until it's incorporated into an official release, you'll need to patch it yourself or use the Debian package compiled by mySociety (see link in [issue 305](https://github.com/sebbacon/alaveteli/issues/305))
* Ensure you have values for new config variables (see `config/general.yml-example`):
  * EXCEPTION_NOTIFICATIONS_FROM
  * EXCEPTION_NOTIFICATIONS_TO
* The recommended Varnish config has changed, so that we ignore more cookies.  You should review your Varnish config with respect to the example at `config/varnish-alaveteli.vcl`.

# Version 0.4

## Highlighted features
* Complete overhaul of design, including improved search, modern look and feel, more twitter links, etc
* A banner alerts visitors from other countries to existing sites in their country, or exhorts them to make their own
* Bounce emails that result from user alerts are automatically processed and hard bouncing accounts do not continue to receive alerts.
  See the new instructions in INSTALL-exim4.md for details of how to set this up.
* Logged in users now have the ability to download a zipfile of the entire correspondence for a request
* Improved UI for responding to requests.  The user now has a single option to "reply" at the bottom of a request, and can adjust who they are replying to on the next page
* [Full list of changes on github](https://github.com/sebbacon/alaveteli/issues?sort=created&direction=desc&state=closed&milestone=7)

## Upgrade notes
* Remember to `rake db:migrate` and `git submodule update`
* Ensure you have values for new config variables (see `config/general.yml-example`):
  * FORWARD_NONBOUNCE_RESPONSES_TO
  * TRACK_SENDER_EMAIL
  * TRACK_SENDER_NAME
  * HTML_TO_PDF_COMMAND
  * NEW_RESPONSE_REMINDER_AFTER_DAYS
  * FORCE_REGISTRATION_ON_NEW_REQUEST
* The config variable `FRONTPAGE_SEARCH_EXAMPLES` is no longer used, so you should remove it to avoid confusion.
* Execute `script/rebuild-xapian-index` to create new xapian index
  terms used in latest version of search (can take a long time)
* Install wkhtmltopdf to enable PDFs in downloadable zipfiles.  A
  static binary is recommended on Linux in order to run the command
  headless: http://code.google.com/p/wkhtmltopdf/downloads/list
* Ensure your webserver can serve up generated files by symlinking `cache/zips/download` to `public/download` (this is also done by the `rails-post-deploy` script).  If you're using Passenger + Apache, you'll need to add a `PassengerResolveSymlinksInDocumentRoot on` directive to the configuration.
  * Note that the zipfile download functionality will currently hang if you're running Alaveteli single-threaded, as it creates a new request to the server to get the print stylesheet version!
* Configure your MTA to handle bounce emails from alerts (see INSTALL-exim4.md)

# Version 0.3

## Highlighted features
* New search filters / UI on request page, authorities page, and search page.  Upgrades require a rebuild of the Xapian index (`./script/xapian-index-rebuild`).  Design isn't beautiful; to be fixed in next release.
* Introduce reCaptcha for people apparently coming from foreign countries (to combat spam) (requires values for new config variables `ISO_COUNTRY_CODE` and `GAZE_URL`, and existing config variables `RECAPTCHA_PUBLIC_KEY` and `RECAPTCHA_PRIVATE_KEY`)
* Better admin interface for editing multiple translations of a public body at once
## Other
* [Full list of changes on github](https://github.com/sebbacon/alaveteli/issues?milestone=5&state=closed)