File tree Expand file tree Collapse file tree 1 file changed +7
-8
lines changed
Expand file tree Collapse file tree 1 file changed +7
-8
lines changed Original file line number Diff line number Diff line change @@ -143,6 +143,13 @@ sb.createStream = function (opts) {
143143 sources = data . clock
144144
145145 i . each ( self . history ( sources ) , function ( data ) { d . _data ( data ) } )
146+
147+ //the _update listener must be set after the history is queued.
148+ //otherwise there is a race between the first client message
149+ //and the next update (which may come in on another stream)
150+ //this problem will probably not be encountered until you have
151+ //thousands of scuttlebutts.
152+
146153 self . on ( '_update' , onUpdate )
147154
148155 d . _data ( 'SYNC' )
@@ -218,14 +225,6 @@ sb.createStream = function (opts) {
218225 if ( ! d . writable && ! opts . clock )
219226 start ( { clock :{ } } )
220227
221- //if tail, and writable,
222- //the _update listener must be set after the history is queued.
223- //otherwise there is a race between the first client message
224- //and the next update (which may come in on another stream)
225- //this problem will probably not be encountered until you have
226- //thousands of scuttlebutts.
227- else if ( tail )
228- self . on ( '_update' , onUpdate )
229228 } else if ( opts . sendClock ) {
230229 //send my current clock.
231230 //so the other side knows what to send
You can’t perform that action at this time.
0 commit comments